Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected void configure() {
}

if (withReconSqlDb) {
reconSqlDB = new AbstractReconSqlDBTest();
reconSqlDB = new AbstractReconSqlDBTest(tmpDir.toPath());
modules.addAll(reconSqlDB.getReconSqlDBModules());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public class TestContainerStateCounts extends AbstractReconSqlDBTest {
private static final int NUM_DELETED_CONTAINERS = 4;
private static final int NUM_CLOSED_CONTAINERS = 3;

public TestContainerStateCounts() {
super();
}


@BeforeEach
public void setUp() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ public class TestEndpoints extends AbstractReconSqlDBTest {
private PipelineManager pipelineManager;
private ReconPipelineManager reconPipelineManager;

public TestEndpoints() {
super();
}

private void initializeInjector() throws Exception {
reconOMMetadataManager = getTestReconOmMetadataManager(
initializeNewOmMetadataManager(Files.createDirectory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ public class TestOmDBInsightEndPoint extends AbstractReconSqlDBTest {
private OzoneConfiguration ozoneConfiguration;
private Set<Long> generatedIds = new HashSet<>();

public TestOmDBInsightEndPoint() {
super();
}

private long generateUniqueRandomLong() {
long newValue;
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
public class TestTaskStatusService extends AbstractReconSqlDBTest {
private TaskStatusService taskStatusService;

public TestTaskStatusService() {
super();
}

@BeforeEach
public void setUp() {
Injector parentInjector = getInjector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
*/
public class TestContainerHealthTask extends AbstractReconSqlDBTest {

public TestContainerHealthTask() {
super();
}

@SuppressWarnings("checkstyle:methodlength")
@Test
public void testRun() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,24 @@
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.Provider;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.util.FileSystemUtils;

/**
* Class that provides a Recon SQL DB with all the tables created, and APIs
* to access the DAOs easily.
*/
public class AbstractReconSqlDBTest {
private Path temporaryFolder;

private Injector injector;
private DSLContext dslContext;
private Provider<DataSourceConfiguration> configurationProvider;

public AbstractReconSqlDBTest() {
}

public void init(Path temporaryFolder) {
try {
temporaryFolder = Files.createTempDirectory("JunitConfig");
FileSystemUtils.deleteRecursively(temporaryFolder.resolve("Config"));
configurationProvider =
new DerbyDataSourceConfigurationProvider(Files.createDirectory(
temporaryFolder.resolve("Config")).toFile());
Expand All @@ -69,12 +72,17 @@ public AbstractReconSqlDBTest() {
}
}

public AbstractReconSqlDBTest(Path temporaryFolder) {
init(temporaryFolder);
}

protected AbstractReconSqlDBTest(Provider<DataSourceConfiguration> provider) {
configurationProvider = provider;
}

@BeforeEach
public void createReconSchemaForTest() throws IOException {
public void createReconSchemaForTest(@TempDir Path temporaryFolder) throws IOException {
init(temporaryFolder);
injector = Guice.createInjector(getReconSqlDBModules());
dslContext = DSL.using(new DefaultConfiguration().set(
injector.getInstance(DataSource.class)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
*/
public class TestReconInternalSchemaDefinition extends AbstractReconSqlDBTest {

public TestReconInternalSchemaDefinition() {
super();
}

@Test
public void testSchemaCreated() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static Stream<Object> parametersSource() throws IOException {
public void testSchemaSetup(Provider<DataSourceConfiguration> provider)
throws SQLException, IOException {
AbstractReconSqlDBTest reconSqlDB = new AbstractReconSqlDBTest(provider);
reconSqlDB.createReconSchemaForTest();
reconSqlDB.createReconSchemaForTest(temporaryFolder);
assertNotNull(reconSqlDB.getInjector());
assertNotNull(reconSqlDB.getConfiguration());
assertNotNull(reconSqlDB.getDslContext());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
*/
public class TestSqlSchemaSetup extends AbstractReconSqlDBTest {

public TestSqlSchemaSetup() {
super();
}

/**
* Make sure schema was created correctly.
* @throws SQLException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
*/
public class TestStatsSchemaDefinition extends AbstractReconSqlDBTest {

public TestStatsSchemaDefinition() {
super();
}

@Test
public void testIfStatsSchemaCreated() throws Exception {
Connection connection = getConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
*/
public class TestUtilizationSchemaDefinition extends AbstractReconSqlDBTest {

public TestUtilizationSchemaDefinition() {
super();
}

@Test
public void testReconSchemaCreated() throws Exception {
Connection connection = getConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public class TestContainerSizeCountTask extends AbstractReconSqlDBTest {
private ContainerSizeCountTask task;
private DSLContext dslContext;

public TestContainerSizeCountTask() {
super();
}

@BeforeEach
public void setUp() {
utilizationSchemaDefinition =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public class TestFileSizeCountTask extends AbstractReconSqlDBTest {
private FileSizeCountTask fileSizeCountTask;
private DSLContext dslContext;

public TestFileSizeCountTask() {
super();
}

@BeforeEach
public void setUp() {
fileCountBySizeDao = getDao(FileCountBySizeDao.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public class TestOmTableInsightTask extends AbstractReconSqlDBTest {
private boolean isSetupDone = false;
private ReconOMMetadataManager reconOMMetadataManager;

public TestOmTableInsightTask() {
super();
}

private void initializeInjector() throws IOException {
reconOMMetadataManager = getTestReconOmMetadataManager(
initializeNewOmMetadataManager(Files.createDirectory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public class TestReconTaskControllerImpl extends AbstractReconSqlDBTest {
private ReconTaskController reconTaskController;
private ReconTaskStatusDao reconTaskStatusDao;

public TestReconTaskControllerImpl() {
super();
}

@BeforeEach
public void setUp() {
OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
Expand Down