@BeforeClass @Override protected void springTestContextPrepareTestInstance() throws Exception { artifactoryHomeBoundTest = createArtifactoryHomeTest(); artifactoryHomeBoundTest.bindArtifactoryHome(); super.springTestContextPrepareTestInstance(); try (Connection connection = jdbcHelper.getDataSource().getConnection()) { DbTestUtils.refreshOrRecreateSchema(connection, storageProperties.getDbType()); } TestUtils.invokeMethodNoArgs(dbService, "initializeIdGenerator"); }
public void verifyDbResourcesReleased() throws IOException, SQLException { // make sure there are no active connections PoolingDataSource ds = (PoolingDataSource) jdbcHelper.getDataSource(); GenericObjectPool pool = TestUtils.getField(ds, "_pool", GenericObjectPool.class); assertEquals( pool.getNumActive(), 0, "Found " + pool.getNumActive() + " active connections after test ended:\n" + TestUtils.invokeMethodNoArgs(pool, "debugInfo")); artifactoryHomeBoundTest.unbindArtifactoryHome(); }
@AfterMethod public void unbindArtifactoryHome() { artifactoryHomeBoundTest.unbindArtifactoryHome(); }
@BeforeMethod public void bindArtifactoryHome() { artifactoryHomeBoundTest.bindArtifactoryHome(); }