Package org.apache.xindice.core.data

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


        if (value == null) {
            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid null value");
        }
        checkOpened();
        checkReadOnly();
        hashTable.put(key, new Record(key, value));
        return true;
    }
View Full Code Here


        if (value == null) {
            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid null value");
        }
        checkOpened();
        checkReadOnly();
        hashTable.put(key, new Record(key, value));
        return true;
    }
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());
        assertTrue(set.hasMoreRecords() == false);

        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(filer.getRecordCount(), THREADS * ITERATIONS);
        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

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.