vgritsenko    2003/12/18 18:33:06

  Modified:    java/tests/src/org/apache/xindice/core/filer
                        FilerTestCase.java
  Log:
  Add a test case for a large (>1 page) key
  
  Revision  Changes    Path
  1.12      +28 -2     
xml-xindice/java/tests/src/org/apache/xindice/core/filer/FilerTestCase.java
  
  Index: FilerTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/tests/src/org/apache/xindice/core/filer/FilerTestCase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FilerTestCase.java        18 Dec 2003 14:45:50 -0000      1.11
  +++ FilerTestCase.java        19 Dec 2003 02:33:06 -0000      1.12
  @@ -336,4 +336,30 @@
               }
           }
       }
  +
  +    public void testLargeKey() throws Exception {
  +        assertTrue(filer.getRecordCount() == 0);
  +
  +        // That's good for three pages
  +        final int SIZE = 8192 + 32;
  +
  +        StringBuffer sb = new StringBuffer(SIZE);
  +        sb.append("KEY");
  +        for (int k = 0; k < SIZE - 3; k++) {
  +            sb.append('0');
  +        }
  +        final Key key = new Key(sb.toString());
  +        final Value value = new Value("<test/>");
  +
  +        assertTrue(filer.writeRecord(key, value));
  +
  +        assertEquals(filer.getRecordCount(), 1);
  +        Record record = filer.readRecord(key);
  +        assertNotNull("Record with key '" + key + "' was not found",
  +                      record);
  +        assertEquals("Expected record with key '" + key + "', found record 
with key '" + record.getKey() + "'",
  +                     key, record.getKey());
  +        assertEquals("Expected record with value '" + value + "', found 
record with value '" + record.getValue() + "'",
  +                     value, record.getValue());
  +    }
   }
  
  
  

Reply via email to