Package org.apache.xindice.core.data

Examples of org.apache.xindice.core.data.Record


                }
                return document;
            }
        }

        Record record = filer.readRecord(key);
        if (record == null) {
            return null;
        }

        Value value;
        InlineMetaMap metaMap = null;
        if (inlineMetaService == null) {
            value = record.getValue();

            if (log.isTraceEnabled()) {
                log.trace(localDebugHeader + "Type is not available, Length=" + value.getLength());
            }
        } else {
            InlineMetaService.DatabaseEntry databaseEntry = inlineMetaService.readDatabaseEntry(record.getValue());
            metaMap = databaseEntry.map;
            value = databaseEntry.value;

            if (log.isTraceEnabled()) {
                log.trace(localDebugHeader + "Type=" + metaMap.get("type") + ", Length=" + value.getLength());
View Full Code Here


    public void testSuccessWriteRecord() throws Exception {
        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
        assertEquals(1, filer.getRecordCount());

        Record result = filer.readRecord(TEST_KEY);
        assertEquals(TEST_VALUE, result.getValue());

        RecordSet set = filer.getRecordSet();
        assertEquals(result.getValue(), set.getNextRecord().getValue());
        assertFalse(set.hasMoreRecords());

        filer.deleteRecord(TEST_KEY);
        assertEquals(0, filer.getRecordCount());
    }
View Full Code Here

        filer.deleteRecord(TEST_KEY);
        assertEquals(0, filer.getRecordCount());
    }

    public void testFailReadDeletedRecord() throws Exception {
        Record result = filer.readRecord(TEST_KEY);
        assertNull(result);
    }
View Full Code Here

    public void testReadRecord() throws Exception {
        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
        assertEquals(1, filer.getRecordCount());

        // Valid key
        Record result = filer.readRecord(TEST_KEY);
        assertEquals(TEST_VALUE, result.getValue());
    }
View Full Code Here

    public void testFailReadRecordNullKey() throws Exception {
        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
        assertEquals(1, filer.getRecordCount());

        // Null key
        Record result = filer.readRecord(null);
        assertNull(result);
    }
View Full Code Here

    public void testFailReadRecordEmptyKey() throws Exception {
        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
        assertEquals(1, filer.getRecordCount());

        // Empty key
        Record result = filer.readRecord(new Key(""));
        assertNull(result);
    }
View Full Code Here

    public void testFailReadRecordUnknownKey() throws Exception {
        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
        assertEquals(1, filer.getRecordCount());

        // Non-existant key
        Record result = filer.readRecord(new Key("non-existant-key"));
        assertNull(result);
    }
View Full Code Here

        assertEquals(1, filer.getRecordCount());

        // Valid key
        filer.deleteRecord(TEST_KEY);
        assertEquals(0, filer.getRecordCount());
        Record result = filer.readRecord(TEST_KEY);
        assertNull(result);
    }
View Full Code Here

        assertEquals(THREADS * ITERATIONS, filer.getRecordCount());
        for (int i = 0; i < THREADS; i++) {
            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);
                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());
            }
        }
    }
View Full Code Here

       // Check results
       assertEquals(1, filer.getRecordCount());
       Key key = new Key("key");
       Value value = new Value("<test document/>");
       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());
   }
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.data.Record

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.