fixed test cases

This commit is contained in:
Jeremy Long
2017-05-05 15:17:39 -04:00
parent 55bfe4cad8
commit 5681e0bfdf
4 changed files with 19 additions and 5 deletions

View File

@@ -230,6 +230,16 @@ public final class CveDB implements AutoCloseable {
}
}
/**
* Method added for testing, returns the current usage count of the CveDB
* singleton.
*
* @return the current usage of the CveDB singleton
*/
protected synchronized int getUsageCount() {
return usageCount;
}
/**
* Opens the database connection. If the database does not exist, it will
* create a new one.

View File

@@ -68,8 +68,10 @@ public class CveDBIT extends BaseDBTestCase {
} catch (DatabaseException | SQLException ex) {
fail(ex.getMessage());
} finally {
int start = instance.getUsageCount();
instance.close();
assertFalse(instance.isOpen());
int end = instance.getUsageCount();
assertTrue( end < start);
}
}

View File

@@ -49,8 +49,10 @@ public class CveDBMySqlIT extends BaseTest {
System.out.println("Unable to connect to the My SQL database; verify that the db server is running and that the schema has been generated");
fail(ex.getMessage());
} finally {
int start = instance.getUsageCount();
instance.close();
assertFalse(instance.isOpen());
int end = instance.getUsageCount();
assertTrue( end < start);
}
}

View File

@@ -320,9 +320,6 @@ Copyright (c) 2012 - Jeremy Long
<value>${project.build.directory}/temp</value>
</property>
</systemProperties>
<excludes>
<exclude>**/*MySqlIT.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
@@ -336,6 +333,9 @@ Copyright (c) 2012 - Jeremy Long
<value>${project.build.directory}/temp</value>
</property>
</systemProperties>
<excludes>
<exclude>**/*MySqlIT.java</exclude>
</excludes>
</configuration>
<executions>
<execution>