svn commit: r541504 [7/7] - in /xml/xindice/trunk: ./ config/ java/scratchpad/webadmin/ java/src/org/apache/xindice/client/xmldb/embed/ java/src/org/apache/xindice/core/ java/src/org/apache/xindice/core/data/ java/src/org/apache/xindice/core/filer/ jav...

[email protected]
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
Copied: xml/xindice/trunk/java/src/org/apache/xindice/xml/Xml2HtmlWriter.java (from r541498, xml/xindice/trunk/java/scratchpad/webadmin/src/org/apache/xindice/xml/Xml2HtmlWriter.java)
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/xml/Xml2HtmlWriter.java?view=diff&rev=541504&p1=xml/xindice/trunk/java/scratchpad/webadmin/src/org/apache/xindice/xml/Xml2HtmlWriter.java&r1=541498&p2=xml/xindice/trunk/java/src/org/apache/xindice/xml/Xml2HtmlWriter.java&r2=541504
==============================================================================
--- xml/xindice/trunk/java/scratchpad/webadmin/src/org/apache/xindice/xml/Xml2HtmlWriter.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/xml/Xml2HtmlWriter.java Thu May 24 18:43:39 2007
@@ -19,7 +19,17 @@
 
 package org.apache.xindice.xml;
 
-import org.w3c.dom.*;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Attr;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.NodeList;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.apache.xindice.util.StringUtilities;
 
 import java.io.BufferedWriter;
 import java.io.IOException;
@@ -32,7 +42,7 @@
 /**
  * Xml2HtmlWriter takes a Document, DocumentFragment, or Element and
  * streams it as html to an output source (or a String).
- * 
+ * <p/>
  * a css stylesheet should define these classes:
  * xml-misc, xml-element-name, xml-attribute-name, xml-attribute-content,
  * xml-element-content, xml-comment, xml-processing, xml-cdata
@@ -41,280 +51,297 @@
  * @version $Id$
  */
 public class Xml2HtmlWriter {
-	
-	protected static final String indent = "&nbsp;";
-	
-	protected Node node = null;
-	
-	public Xml2HtmlWriter(Node node) throws DOMException {
-		this.node = node;
-	}
-	
-	/**
-	 * write writes the node to the writer as text.
-	 *
-	 * @param writer The Writer to write to
-	 */
-	public void write(Writer writer) throws IOException {
-		write(node, writer);
-	 }
-	 
-	/**
-	 * write writes the node to the OutputStream as text.
-	 * 
-	 * @param output The OutputStream to write to
-	 */
-	public void write(OutputStream output) throws IOException {
-		write(node, output);
-	}
-
-	/**
-	 * toString returns the node as a String.
-	 * 
-	 * @return The String value
-	 */
-	public String toString() {
-		return toString(node);
-	}
-	
-	/**
-	 * writes the Node to the writer.
-	 * 
-	 * @param writer The Writer to write to.
-	 * @param node The Node to write.
-	 * @param currentIndent the current indent.
-	 * @throws IOException while writing to the writer.
-	 */
-	protected static void writeNode(Writer writer, Node node, int currentIndent) throws IOException {
-		short type = node.getNodeType();
-		switch (type) {
-			
-			case Node.DOCUMENT_NODE: {
-				writeIndent(writer, currentIndent);
-				writer.write("<span class=\"xml-processing\">&lt;?xml ");
-				writer.write(" version=\"1.0\"?&gt;</span><br />\n");
-				currentIndent--;
-				writeChildren(writer, node, currentIndent);
-				break;
-			}
-			
-			case Node.DOCUMENT_FRAGMENT_NODE: {
-				writeChildren(writer, node, currentIndent);
-				break;
-			}
-			
-			case Node.DOCUMENT_TYPE_NODE: {
-				break;
-			}
-			
-			case Node.ELEMENT_NODE: {
-				Element e = (Element)node;
-				String n = e.getTagName();
-				
-				writeIndent(writer, currentIndent);
-				writer.write("<span class=\"xml-misc\">&lt;</span>");
-				writer.write("<span class=\"xml-element-name\">");
-				writer.write(n);
-				writer.write("</span>");
-				
-				NamedNodeMap a = e.getAttributes();
-				int size = a.getLength();
-				for ( int i = 0; i < size; i++ ) {
-					Attr att = (Attr)a.item(i);
-					writer.write(' ');
-					writeNode(writer, att, currentIndent);
-				}
-				
-				if ( e.hasChildNodes() ) {
-					writer.write("<span class=\"xml-misc\">&gt;</span><br />\n");
-					writeChildren(writer, node, currentIndent);
-					//writeIndent(writer, currentIndent);
-					writer.write("<span class=\"xml-misc\">&lt;/</span>");
-					writer.write("<span class=\"xml-element-name\">");
-					writer.write(n);
-					writer.write("</span><span class=\"xml-misc\">&gt;</span><br />\n");
-				} else {
-					writer.write("<span class=\"xml-misc\"> /&gt;</span><br />\n");
-				}
-				break;
-			}
-			
-			case Node.ATTRIBUTE_NODE: {
-				Attr a = (Attr)node;
-				writer.write("<span class=\"xml-attribute-name\">");
-				writer.write(a.getName());
-				writer.write("</span><span class=\"xml-misc\">=\"</span>");
-				writer.write("<span class=\"xml-attribute-content\">");
-				writeEscapedText(writer, a.getValue(), currentIndent);
-				writer.write("</span><span class=\"xml-misc\">\"</span>");
-				break;
-			}
-			
-			case Node.ENTITY_REFERENCE_NODE: {
-				break;
-			}
-			
-			case Node.ENTITY_NODE: {
-				break;
-			}
-			
-			case Node.NOTATION_NODE: {
-				break;
-			}
-			
-			case Node.PROCESSING_INSTRUCTION_NODE: {
-				ProcessingInstruction pi = (ProcessingInstruction)node;
-				writeIndent(writer, currentIndent);
-				writer.write("<span class=\"xml-processing\">&lt;?");
-				writer.write(pi.getTarget());
-				writer.write(" ");
-				writer.write(pi.getData());
-				writer.write("?&gt;</span><br />\n");
-				break;
-			}
-			
-			case Node.TEXT_NODE: {
-				writeIndent(writer, currentIndent);
-				writer.write("<span class=\"xml-element-content\">");
-				writeEscapedText(writer, node.getNodeValue(), currentIndent);
-				writer.write("</span>");
-				break;
-			}
-			
-			case Node.CDATA_SECTION_NODE: {
-				writeIndent(writer, currentIndent);
-				writer.write("<span class=\"xml-cdata\">&lt;![CDATA[");
-				writeEscapedText(writer, node.getNodeValue(), currentIndent);
-				writer.write("]]&gt;</span><br />");
-				break;
-			}
-			
-			case Node.COMMENT_NODE: {
-				writeIndent(writer, currentIndent);
-				writer.write("<span class=\"xml-comment\">&lt;!--");
-				writeEscapedText(writer, node.getNodeValue(), currentIndent);
-				writer.write("--&gt;</span><br />");
-				break;
-			}
-		}
-	}
-	
-	/**
-	 * writes the children nodes for the given node.
-	 * 
-	 * @param writer The Writer to write to.
-	 * @param node The Parent Node.
-	 * @param currentIndent The current Indent.
-	 * @throws IOException while writing to the writer.
-	 */
-	protected static void writeChildren(Writer writer, Node node, int currentIndent) throws IOException {
-		NodeList l = node.getChildNodes();
-		int size = l.getLength();
-		currentIndent++;
-		for ( int i = 0; i < size; i++ ) {
-			writeNode(writer, l.item(i), currentIndent);
-		}
-	}
-	
-	/**
-	 * writes the text as escaped html.
-	 * 
-	 * @param writer The Writer to write to.
-	 * @param text The text to write.
-	 * @param currentIndent The current Indent.
-	 * @throws IOException
-	 */
-	protected static void writeEscapedText(Writer writer, String text, int currentIndent) throws IOException {
-		char[] value = text.toCharArray();
-		String outval = null;
-		int start = 0;
-		int len = 0;
-		for(int i = 0; i < value.length; i++) {
-			switch ( value[i] ) {
-				case '&'  : outval = "&amp;";  break;
-				case '\'' : outval = "&apos;"; break;
-				case '\"' : outval = "&quot;"; break;
-				case '<'  : outval = "&lt;";   break;
-				case '>'  : outval = "&gt;";   break;
-				/*case '\n'  :
-					writer.write("<br />");
-					writeIndent(writer, currentIndent);
-					outval = null;
-					break;*/
-				default   : len++;             break;
-			}
-			
-			if ( outval != null ) {
-				if ( len > 0 ) {
-					writer.write(value, start, len);
-				}
-				writer.write(outval);
-				start = i+1;
-				len = 0;
-				outval = null;
-			}
-		}
-		if(len > 0) {
-			writer.write(value, start, len);
-		}
-	}
-	
-	/**
-	 * writes the indent to the writer.
-	 * 
-	 * @param writer The Writer to write to.
-	 * @param currentIndent The current Indent.
-	 * @throws IOException
-	 */
-	protected static void writeIndent(Writer writer, int currentIndent)
-		throws IOException {
-		for(int i = 0; i < currentIndent; i++) {
-			writer.write(indent);
-		}
-	}
-	
-	/**
-	 * write writes the specified node to the writer as text.
-	 * 
-	 * @param node The Node to write.
-	 * @param writer The Writer to write to.
-	 */
-	public static void write(Node node, Writer writer) throws IOException {
-		BufferedWriter buf = new BufferedWriter(writer, 4096);
-		writeNode(buf, node, 0);
-		buf.flush();
-	}
-	
-	/**
-	 * write writes the specified node to the OutputStream as text.
-	 * 
-	 * @param node The Node to write.
-	 * @param output The OutputStream to write to.
-	 */
-	public static void write(Node node, OutputStream output) throws IOException {
-		try {
-			OutputStreamWriter o = new OutputStreamWriter(output, "utf-8");
-			write( node, o);
-		} catch (UnsupportedEncodingException e) {
-			e.printStackTrace();
-		} 
-	}
-	
-	/**
-	 * toString returns the node as a String.
-	 *
-	 * @param node The Node to convert
-	 * @return The String value
-	 */
-	public static String toString( Node node ) {
-		StringWriter sw = new StringWriter();
-		try {
-			write(node, sw);
-			return sw.toString();
-		} catch (IOException e) {
-			e.printStackTrace();
-			return null;
-		}
-	}
+
+    private static final String indent = "&nbsp;&nbsp;";
+    private Node node = null;
+    private static final Log log = LogFactory.getLog(Xml2HtmlWriter.class);
+
+    public Xml2HtmlWriter(Node node) throws DOMException {
+        this.node = node;
+    }
+
+    /**
+     * write writes the node to the writer as text.
+     *
+     * @param writer The Writer to write to
+     */
+    public void write(Writer writer) throws IOException {
+        write(node, writer);
+    }
+
+    /**
+     * write writes the node to the OutputStream as text.
+     *
+     * @param output The OutputStream to write to
+     */
+    public void write(OutputStream output) throws IOException {
+        write(node, output);
+    }
+
+    /**
+     * toString returns the node as a String.
+     *
+     * @return The String value
+     */
+    public String toString() {
+        return toString(node);
+    }
+
+    /**
+     * writes the Node to the writer.
+     *
+     * @param writer        The Writer to write to.
+     * @param node          The Node to write.
+     * @param currentIndent the current indent.
+     * @throws IOException while writing to the writer.
+     */
+    private static void writeNode(Writer writer, Node node, int currentIndent) throws IOException {
+        short type = node.getNodeType();
+
+        switch (type) {
+            case Node.DOCUMENT_NODE: {
+                writeIndent(writer, currentIndent);
+                writer.write("<span class=\"xml-processing\">&lt;?xml ");
+                writer.write(" version=\"1.0\"?&gt;</span><br />\n");
+                currentIndent--;
+                writeChildren(writer, node, currentIndent);
+                break;
+            }
+
+            case Node.DOCUMENT_FRAGMENT_NODE: {
+                writeChildren(writer, node, currentIndent);
+                break;
+            }
+
+            case Node.DOCUMENT_TYPE_NODE: {
+                break;
+            }
+
+            case Node.ELEMENT_NODE: {
+                Element e = (Element) node;
+                String n = e.getTagName();
+
+                writeIndent(writer, currentIndent);
+                writer.write("<span class=\"xml-misc\">&lt;</span>");
+                writer.write("<span class=\"xml-element-name\">");
+                writer.write(n);
+                writer.write("</span>");
+
+                NamedNodeMap a = e.getAttributes();
+                int size = a.getLength();
+                for (int i = 0; i < size; i++) {
+                    Attr att = (Attr) a.item(i);
+                    writer.write(' ');
+                    writeNode(writer, att, currentIndent);
+                }
+
+                if (e.hasChildNodes()) {
+                    writer.write("<span class=\"xml-misc\">&gt;</span><br />\n");
+                    writeChildren(writer, node, currentIndent);
+                    writeIndent(writer, currentIndent);
+                    writer.write("<span class=\"xml-misc\">&lt;/</span>");
+                    writer.write("<span class=\"xml-element-name\">");
+                    writer.write(n);
+                    writer.write("</span><span class=\"xml-misc\">&gt;</span><br />\n");
+                } else {
+                    writer.write("<span class=\"xml-misc\"> /&gt;</span><br />\n");
+                }
+                break;
+            }
+
+            case Node.ATTRIBUTE_NODE: {
+                Attr a = (Attr) node;
+                writer.write("<span class=\"xml-attribute-name\">");
+                writer.write(a.getName());
+                writer.write("</span><span class=\"xml-misc\">=\"</span>");
+                writer.write("<span class=\"xml-attribute-content\">");
+                writeEscapedText(writer, a.getValue(), currentIndent);
+                writer.write("</span><span class=\"xml-misc\">\"</span>");
+                break;
+            }
+
+            case Node.ENTITY_REFERENCE_NODE: {
+                break;
+            }
+
+            case Node.ENTITY_NODE: {
+                break;
+            }
+
+            case Node.NOTATION_NODE: {
+                break;
+            }
+
+            case Node.PROCESSING_INSTRUCTION_NODE: {
+                ProcessingInstruction pi = (ProcessingInstruction) node;
+                writeIndent(writer, currentIndent);
+                writer.write("<span class=\"xml-processing\">&lt;?");
+                writer.write(pi.getTarget());
+                writer.write(" ");
+                writer.write(pi.getData());
+                writer.write("?&gt;</span><br />\n");
+                break;
+            }
+
+            case Node.TEXT_NODE: {
+                if (!StringUtilities.isBlank(node.getNodeValue())) {
+                    writeIndent(writer, currentIndent);
+                    writer.write("<span class=\"xml-element-content\">");
+                    writeEscapedText(writer, node.getNodeValue().trim(), currentIndent);
+                    writer.write("</span>");
+                }
+                break;
+            }
+
+            case Node.CDATA_SECTION_NODE: {
+                writeIndent(writer, currentIndent);
+                writer.write("<span class=\"xml-cdata\">&lt;![CDATA[");
+                writeEscapedText(writer, node.getNodeValue(), currentIndent);
+                writer.write("]]&gt;</span><br />");
+                break;
+            }
+
+            case Node.COMMENT_NODE: {
+                writeIndent(writer, currentIndent);
+                writer.write("<span class=\"xml-comment\">&lt;!--");
+                writeEscapedText(writer, node.getNodeValue(), currentIndent);
+                writer.write("--&gt;</span><br />");
+                break;
+            }
+        }
+    }
+
+    /**
+     * writes the children nodes for the given node.
+     *
+     * @param writer        The Writer to write to.
+     * @param node          The Parent Node.
+     * @param currentIndent The current Indent.
+     * @throws IOException while writing to the writer.
+     */
+    private static void writeChildren(Writer writer, Node node, int currentIndent) throws IOException {
+        NodeList l = node.getChildNodes();
+        int size = l.getLength();
+        currentIndent++;
+        for (int i = 0; i < size; i++) {
+            writeNode(writer, l.item(i), currentIndent);
+        }
+    }
+
+    /**
+     * writes the text as escaped html.
+     *
+     * @param writer        The Writer to write to.
+     * @param text          The text to write.
+     * @param currentIndent The current Indent.
+     * @throws IOException
+     */
+    private static void writeEscapedText(Writer writer, String text, int currentIndent) throws IOException {
+        char[] value = text.toCharArray();
+        String outval = null;
+        int start = 0;
+        int len = 0;
+        for (int i = 0; i < value.length; i++) {
+            switch (value[i]) {
+                case '&':
+                    outval = "&amp;";
+                    break;
+                case '\'':
+                    outval = "&apos;";
+                    break;
+                case '\"':
+                    outval = "&quot;";
+                    break;
+                case '<':
+                    outval = "&lt;";
+                    break;
+                case '>'  :
+                    outval = "&gt;";
+                    break;
+                case '\n':
+                    //writer.write("<br />");
+                    //writeIndent(writer, currentIndent);
+                    outval = "<br />";
+                    for (int i1 = 0; i1 < currentIndent; i1++) {
+                        outval += indent;
+                    }
+                    break;
+                default:
+                    len++;
+                    break;
+            }
+
+            if (outval != null) {
+                if (len > 0) {
+                    writer.write(value, start, len);
+                }
+                writer.write(outval);
+                start = i + 1;
+                len = 0;
+                outval = null;
+            }
+        }
+        if (len > 0) {
+            writer.write(value, start, len);
+        }
+    }
+
+    /**
+     * writes the indent to the writer.
+     *
+     * @param writer        The Writer to write to.
+     * @param currentIndent The current Indent.
+     * @throws IOException
+     */
+    private static void writeIndent(Writer writer, int currentIndent)
+            throws IOException {
+        for (int i = 0; i < currentIndent; i++) {
+            writer.write(indent);
+        }
+    }
+
+    /**
+     * write writes the specified node to the writer as text.
+     *
+     * @param node   The Node to write.
+     * @param writer The Writer to write to.
+     */
+    public static void write(Node node, Writer writer) throws IOException {
+        BufferedWriter buf = new BufferedWriter(writer, 4096);
+        writeNode(buf, node, 0);
+        buf.flush();
+    }
+
+    /**
+     * write writes the specified node to the OutputStream as text.
+     *
+     * @param node   The Node to write.
+     * @param output The OutputStream to write to.
+     */
+    public static void write(Node node, OutputStream output) throws IOException {
+        try {
+            OutputStreamWriter o = new OutputStreamWriter(output, "utf-8");
+            write(node, o);
+        } catch (UnsupportedEncodingException e) {
+            log.error(e); //won't happen
+        }
+    }
+
+    /**
+     * toString returns the node as a String.
+     *
+     * @param node The Node to convert
+     * @return The String value
+     */
+    public static String toString(Node node) {
+        StringWriter sw = new StringWriter();
+        try {
+            write(node, sw);
+            return sw.toString();
+        } catch (IOException e) {
+            log.error(e);
+            return null;
+                }
+        }
 
 }

Modified: xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/BTreeFilerTest.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/BTreeFilerTest.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/BTreeFilerTest.java (original)
+++ xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/BTreeFilerTest.java Thu May 24 18:43:39 2007
@@ -41,7 +41,7 @@
 
         Key key = new Key("key");
         for (int i = 0; i < iterations; i++) {
-            assertTrue(filer.writeRecord(key, TEST_VALUE));
+            filer.writeRecord(key, TEST_VALUE);
             assertTrue(filer.deleteRecord(key));
         }
 

Modified: xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/FilerTestBase.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/FilerTestBase.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/FilerTestBase.java (original)
+++ xml/xindice/trunk/java/tests/src/org/apache/xindice/core/filer/FilerTestBase.java Thu May 24 18:43:39 2007
@@ -105,10 +105,10 @@
     }
 
     public void testSuccessWriteRecord() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
-        Record result = filer.readRecord(TEST_KEY);
+        Record result = filer.readRecord(TEST_KEY, false);
         assertEquals(TEST_VALUE, result.getValue());
 
         RecordSet set = filer.getRecordSet();
@@ -120,7 +120,7 @@
     }
 
     public void testFailReadDeletedRecord() throws Exception {
-        Record result = filer.readRecord(TEST_KEY);
+        Record result = filer.readRecord(TEST_KEY, false);
         assertNull(result);
     }
 
@@ -152,54 +152,54 @@
     }
 
     public void testReadRecord() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // Valid key
-        Record result = filer.readRecord(TEST_KEY);
+        Record result = filer.readRecord(TEST_KEY, false);
         assertEquals(TEST_VALUE, result.getValue());
     }
 
     public void testFailReadRecordNullKey() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // Null key
-        Record result = filer.readRecord(null);
+        Record result = filer.readRecord(null, false);
         assertNull(result);
     }
 
     public void testFailReadRecordEmptyKey() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // Empty key
-        Record result = filer.readRecord(new Key(""));
+        Record result = filer.readRecord(new Key(""), false);
         assertNull(result);
     }
 
     public void testFailReadRecordUnknownKey() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // Non-existant key
-        Record result = filer.readRecord(new Key("non-existant-key"));
+        Record result = filer.readRecord(new Key("non-existant-key"), false);
         assertNull(result);
     }
 
     public void testDeleteRecord() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // Valid key
         filer.deleteRecord(TEST_KEY);
         assertEquals(0, filer.getRecordCount());
-        Record result = filer.readRecord(TEST_KEY);
+        Record result = filer.readRecord(TEST_KEY, false);
         assertNull(result);
     }
 
     public void testDeleteRecordNullKey() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // These should all just fail silently.
@@ -208,7 +208,7 @@
     }
 
     public void testDeleteRecordEmptyKey() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // These should all just fail silently.
@@ -217,7 +217,7 @@
     }
 
     public void testDeleteRecordWrongKey() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
         assertEquals(1, filer.getRecordCount());
 
         // These should all just fail silently.
@@ -228,12 +228,12 @@
     public void testGetRecordCount() throws Exception {
         assertEquals(0, filer.getRecordCount());
 
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
-        assertTrue(filer.writeRecord(new Key("test1"), TEST_VALUE));
-        assertTrue(filer.writeRecord(new Key("test2"), TEST_VALUE));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
+        filer.writeRecord(new Key("test1"), TEST_VALUE);
+        filer.writeRecord(new Key("test2"), TEST_VALUE);
         assertEquals(3, filer.getRecordCount());
 
-        assertTrue(filer.writeRecord(new Key("test3"), TEST_VALUE));
+        filer.writeRecord(new Key("test3"), TEST_VALUE);
         assertEquals(4, filer.getRecordCount());
 
         assertTrue(filer.deleteRecord(new Key("test3")));
@@ -247,9 +247,9 @@
     }
 
     public void testGetRecordSet() throws Exception {
-        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
-        assertTrue(filer.writeRecord(new Key("test2"), TEST_VALUE_2));
-        assertTrue(filer.writeRecord(new Key("test3"), TEST_VALUE_3));
+        filer.writeRecord(TEST_KEY, TEST_VALUE);
+        filer.writeRecord(new Key("test2"), TEST_VALUE_2);
+        filer.writeRecord(new Key("test3"), TEST_VALUE_3);
 
         RecordSet result = filer.getRecordSet();
         assertNotNull(result);
@@ -274,7 +274,7 @@
     public void testInsertManyDocuments() throws Exception {
         int iterations = 1000;
         for (int i = 0; i < iterations; i++) {
-            assertTrue(filer.writeRecord(new Key("key" + i), TEST_VALUE));
+            filer.writeRecord(new Key("key" + i), TEST_VALUE);
         }
 
         assertTrue(filer.getRecordCount() == iterations);
@@ -337,7 +337,7 @@
             for (int ii = 0; ii < ITERATIONS; ii++) {
                 Key key = new Key("T" + i + "I" + ii);
                 Value value = new Value("<test thread=\"" + i + "\" iteration=\"" + ii + "\"/>");
-                Record record = filer.readRecord(key);
+                Record record = filer.readRecord(key, false);
                 assertNotNull("Record with key '" + key + "' was not found",
                               record);
                 assertEquals("Expected record with key '" + key + "', found record with key '" + record.getKey() + "'",
@@ -388,7 +388,7 @@
        assertEquals(1, filer.getRecordCount());
        Key key = new Key("key");
        Value value = new Value("<test document/>");
-       Record record = filer.readRecord(key);
+       Record record = filer.readRecord(key, false);
        assertNotNull("Record with key '" + key + "' was not found", record);
        assertEquals("Expected record with key '" + key + "', found record with key '" + record.getKey() + "'",
                     key, record.getKey());
@@ -407,10 +407,10 @@
         final Key key = new Key(sb.toString());
         final Value value = new Value("<test/>");
 
-        assertTrue(filer.writeRecord(key, value));
+        filer.writeRecord(key, value);
 
         assertEquals(filer.getRecordCount(), 1);
-        Record record = filer.readRecord(key);
+        Record record = filer.readRecord(key, false);
         assertNotNull("Record with key '" + key + "' was not found",
                       record);
         assertEquals("Expected record with key '" + key + "', found record with key '" + record.getKey() + "'",

Modified: xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java (original)
+++ xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java Thu May 24 18:43:39 2007
@@ -200,18 +200,18 @@
         collection.insertBinary("key1", value);
 
         Document document = DOMParser.toDocument("<test value='1'/>");
-        collection.insertDocument("key1", document);
+        collection.setDocument("key1", document);
 
         IndexMatch[] match = query(ind, "test@value", "1", IndexQuery.EQ);
         assertEquals("XML document did not get indexed: ", 1, match.length);
 
-        collection.insertBinary("key1", value);
+        collection.setBinary("key1", value);
 
         match = query(ind, "test@value", "1", IndexQuery.EQ);
         assertEquals("Found previous XML document in the index: ", 0, match.length);
 
         document = DOMParser.toDocument("<test value='2'/>");
-        collection.insertDocument("key1", document);
+        collection.setDocument("key1", document);
 
         match = query(ind, "test@value", "1", IndexQuery.EQ);
         assertEquals("Found previous XML document in the index: ", 0, match.length);

Added: xml/xindice/trunk/lib/commons-fileupload.jar
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/lib/commons-fileupload.jar?view=auto&rev=541504
==============================================================================
Binary file - no diff available.

Propchange: xml/xindice/trunk/lib/commons-fileupload.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: xml/xindice/trunk/status.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/status.xml?view=diff&rev=541504&r1=541503&r2=541504
==============================================================================
--- xml/xindice/trunk/status.xml (original)
+++ xml/xindice/trunk/status.xml Thu May 24 18:43:39 2007
@@ -117,6 +117,9 @@
 
   <changes>
     <release version="1.2" date="unreleased">
+      <action dev="VG" type="add" fixes-bug="42478" due-to="Natalia Shilenkova">
+        Add WebAdmin to the Xindice core (from scratchpad).
+      </action>
       <action dev="VG" type="update">
         Minimum required Java version to build Xindice is now 1.4.
       </action>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.