760N/A * The contents of this file are subject to the terms of the 760N/A * Common Development and Distribution License (the "License"). 760N/A * You may not use this file except in compliance with the License. 760N/A * language governing permissions and limitations under the License. 760N/A * When distributing Covered Code, include this CDDL HEADER in each 760N/A * If applicable, add the following below this CDDL HEADER, with the 760N/A * fields enclosed by brackets "[]" replaced with your own identifying 760N/A * information: Portions Copyright [yyyy] [name of copyright owner] 969N/A * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 760N/A * Use is subject to license terms. 760N/A * Unit tests for {@code JDBCHistoryCache}. 760N/A "org.apache.derby.jdbc.EmbeddedDriver";
760N/A * Create a suite of tests to run. If the Derby classes are not present, 760N/A return new TestSuite(
"JDBCHistoryCacheTest - empty (no derby.jar)");
1466N/A "S.SCHEMANAME FROM SYS.SYSTABLES T, SYS.SYSSCHEMAS S " +
1466N/A "WHERE T.TABLETYPE = 'T' AND T.SCHEMAID = S.SCHEMAID");
760N/A * Set up the test environment with repositories and a cache instance. 760N/A * Clean up after the test. Remove the test repositories and shut down 760N/A // Expect SQLException with SQLState 08006 on successful shutdown 760N/A * Create a database URL to use for this test. The URL points to an 760N/A * in-memory Derby database. 760N/A * @return a database URL 778N/A * Import a new changeset into a Mercurial repository. 778N/A * @param reposRoot the root of the repository 778N/A * @param changesetFile file that contains the changeset to import 778N/A * Assert that two HistoryEntry objects are equal. 778N/A * @param expected the expected entry 778N/A * @param actual the actual entry 778N/A * @throws AssertFailure if the two entries don't match 778N/A * Assert that two lists of HistoryEntry objects are equal. 778N/A * @param expected the expected list of entries 778N/A * @param actual the actual list of entries 778N/A * @throws AssertFailure if the two lists don't match 760N/A * Basic tests for the {@code store()} and {@code get()} methods. 776N/A // test get history for single file 776N/A // test get history for directory 778N/A // test incremental update 778N/A "xyz",
"Return failure when executed with no arguments",
true);
1466N/A // isDir = {null, true, false} 1466N/A // null == auto -> test for physical path -> fails -> assumes path is file 1466N/A // force to take as file (same results as for null) 969N/A // test clearing of cache 761N/A * Test that {@code getLatestCachedRevision()} returns the correct 778N/A // test incremental update 782N/A * Test that {@code hasCacheForDirectory()} works. 786N/A // Use a Mercurial repository and a Subversion repository in this test. 786N/A // None of the repositories should have any history. 786N/A // Store empty history, so still expect false. 786N/A // Store history for Mercurial repository. 786N/A // Store history for Subversion repository. 1466N/A // w/o mercurial repo fix there is a /mercurial subdir, but no /svn subdir 1466N/A // w/ mercurial repo fix there is still no subdir 788N/A * Test that get() is able to continue and return successfully after a lock 788N/A * timeout when accessing the database. 788N/A // Set the lock timeout to one second to make it go faster. 788N/A "('derby.locks.waitTimeout', '1')");
788N/A // Lock one of the tables exclusively in order to block get(). 808N/A // Originally, we locked the FILECHANGES table here, but that triggered 808N/A // now we lock the AUTHORS table instead. 899N/A s.
execute(
"lock table opengrok.authors in exclusive mode");
788N/A // Roll back the transaction in 1.5 seconds so that get() is able to 788N/A // continue after the first timeout. 788N/A // get() should be able to continue after a timeout. 788N/A // Expose any exception thrown in the helper thread. 856N/A * Regression test for bug #11663. If the commit message was longer than 856N/A * the maximum VARCHAR length, a truncation error would be raised by the 856N/A * database. Now the message should be truncated if such a message is 856N/A "this is a line with 48 chars, including newline");
856N/A // Used to get a truncation error from the database here. 883N/A * Test that it is possible to store an entry with no author. 883N/A // Create an entry where author is null