summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-11-03 11:05:52 -0500
committerJames Moger <james.moger@gitblit.com>2014-11-03 12:51:16 -0500
commit6f486197c5aae3246e8175b828fe3e4c8de3906d (patch)
tree46de7bfadab22efb3293364970bc10c937bcb45d /src/test
parente4e9fdae539ec85552755b3a7799b75dbb7c4812 (diff)
downloadiciql-6f486197c5aae3246e8175b828fe3e4c8de3906d.tar.gz
iciql-6f486197c5aae3246e8175b828fe3e4c8de3906d.zip
Add support for SQLite 3.8.7
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/iciql/test/IciqlSuite.java31
-rw-r--r--src/test/java/com/iciql/test/UpgradesTest.java12
2 files changed, 37 insertions, 6 deletions
diff --git a/src/test/java/com/iciql/test/IciqlSuite.java b/src/test/java/com/iciql/test/IciqlSuite.java
index c418938..4800b9a 100644
--- a/src/test/java/com/iciql/test/IciqlSuite.java
+++ b/src/test/java/com/iciql/test/IciqlSuite.java
@@ -110,7 +110,11 @@ public class IciqlSuite {
new TestDb("Derby", true, true, "jdbc:derby:memory:iciql;create=true"),
new TestDb("Derby", true, false, "jdbc:derby:directory:testdbs/derby/iciql;create=true"),
new TestDb("MySQL", false, false, "jdbc:mysql://localhost:3306/iciql", "sa", "sa"),
- new TestDb("PostgreSQL", false, false, "jdbc:postgresql://localhost:5432/iciql", "sa", "sa") };
+ new TestDb("PostgreSQL", false, false, "jdbc:postgresql://localhost:5432/iciql", "sa", "sa"),
+ new TestDb("SQLite", true, true, "jdbc:sqlite:file:iciql?mode=memory&cache=shared"),
+ new TestDb("SQLite", true, false, "jdbc:sqlite:"
+ + new File(baseFolder, "/sqlite/iciql.db").getAbsolutePath())
+ };
private static final TestDb DEFAULT_TEST_DB = TEST_DBS[0];
@@ -256,6 +260,16 @@ public class IciqlSuite {
}
/**
+ * Returns true if the underlying database engine is SQLite.
+ *
+ * @param db
+ * @return true if underlying database engine is SQLite
+ */
+ public static boolean isSQLite(Db db) {
+ return IciqlSuite.getDatabaseEngineName(db).equals("SQLite");
+ }
+
+ /**
* Gets the default schema of the underlying database engine.
*
* @param db
@@ -296,6 +310,7 @@ public class IciqlSuite {
}
deleteRecursively(baseFolder);
+ new File(baseFolder, "/sqlite").mkdirs();
// Start the HSQL and H2 servers in-process
org.hsqldb.Server hsql = startHSQL();
@@ -412,6 +427,20 @@ public class IciqlSuite {
out.println(dividerMajor);
out.println(MessageFormat.format("{0} {1} ({2}) test suite performance results", Constants.NAME,
Constants.VERSION, Constants.VERSION_DATE));
+
+ StringBuilder compressedSystem = new StringBuilder();
+ compressedSystem.append(" on ");
+ compressedSystem.append(System.getProperty("java.vendor"));
+ compressedSystem.append(' ');
+ compressedSystem.append(System.getProperty("java.runtime.version"));
+ compressedSystem.append(", ");
+ compressedSystem.append(System.getProperty("os.name"));
+ compressedSystem.append(' ');
+ compressedSystem.append(System.getProperty("os.version"));
+ compressedSystem.append(", ");
+ compressedSystem.append(System.getProperty("os.arch"));
+ out.println(compressedSystem.toString());
+
out.println(dividerMajor);
List<TestDb> dbs = Arrays.asList(TEST_DBS);
Collections.sort(dbs);
diff --git a/src/test/java/com/iciql/test/UpgradesTest.java b/src/test/java/com/iciql/test/UpgradesTest.java
index 7de691f..4ab1ff1 100644
--- a/src/test/java/com/iciql/test/UpgradesTest.java
+++ b/src/test/java/com/iciql/test/UpgradesTest.java
@@ -32,7 +32,7 @@ import com.iciql.test.models.SupportedTypes.SupportedTypes2;
/**
* Tests the database and table upgrade functions.
- *
+ *
*/
public class UpgradesTest {
@@ -54,7 +54,7 @@ public class UpgradesTest {
// open a second connection to the database
// and then apply the v2 upgrade.
- // For H2 its important to keep the first connection
+ // For an in-memory db its important to keep the first connection
// alive so that the database is not destroyed.
Db db2 = IciqlSuite.openCurrentDb();
@@ -72,7 +72,7 @@ public class UpgradesTest {
db.close();
db2.close();
}
-
+
@Test
public void testDatabaseInheritedUpgrade() {
Db db = IciqlSuite.openNewDb();
@@ -91,7 +91,7 @@ public class UpgradesTest {
// open a second connection to the database
// and then apply the v2 upgrade.
- // For H2 its important to keep the first connection
+ // For an in-memory db its important to keep the first connection
// alive so that the database is not destroyed.
Db db2 = IciqlSuite.openCurrentDb();
@@ -139,6 +139,7 @@ public class UpgradesTest {
final AtomicInteger oldVersion = new AtomicInteger(0);
final AtomicInteger newVersion = new AtomicInteger(0);
+ @Override
public boolean upgradeTable(Db db, String schema, String table, int fromVersion, int toVersion) {
// just claims success on upgrade request
oldVersion.set(fromVersion);
@@ -146,6 +147,7 @@ public class UpgradesTest {
return true;
}
+ @Override
public boolean upgradeDatabase(Db db, int fromVersion, int toVersion) {
// just claims success on upgrade request
oldVersion.set(fromVersion);
@@ -168,7 +170,7 @@ public class UpgradesTest {
class V2DbUpgrader extends BaseDbUpgrader {
}
-
+
/**
* A sample V2 database upgrader class which inherits its
* version from the parent class.