mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 17:19:30 +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
|
* Opens the database connection. If the database does not exist, it will
|
||||||
* create a new one.
|
* create a new one.
|
||||||
|
|||||||
@@ -68,8 +68,10 @@ public class CveDBIT extends BaseDBTestCase {
|
|||||||
} catch (DatabaseException | SQLException ex) {
|
} catch (DatabaseException | SQLException ex) {
|
||||||
fail(ex.getMessage());
|
fail(ex.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
int start = instance.getUsageCount();
|
||||||
instance.close();
|
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");
|
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());
|
fail(ex.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
int start = instance.getUsageCount();
|
||||||
instance.close();
|
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>
|
<value>${project.build.directory}/temp</value>
|
||||||
</property>
|
</property>
|
||||||
</systemProperties>
|
</systemProperties>
|
||||||
<excludes>
|
|
||||||
<exclude>**/*MySqlIT.java</exclude>
|
|
||||||
</excludes>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -336,6 +333,9 @@ Copyright (c) 2012 - Jeremy Long
|
|||||||
<value>${project.build.directory}/temp</value>
|
<value>${project.build.directory}/temp</value>
|
||||||
</property>
|
</property>
|
||||||
</systemProperties>
|
</systemProperties>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/*MySqlIT.java</exclude>
|
||||||
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
Reference in New Issue
Block a user