mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 08:13:43 +01:00
fixed test cases
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6
pom.xml
6
pom.xml
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user