Skip to content

Commit c839271

Browse files
committed
started to prepare the integration tests
1 parent e2add37 commit c839271

File tree

4 files changed

+77
-20
lines changed

4 files changed

+77
-20
lines changed

pom.xml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,32 @@
121121
</dependency>
122122
-->
123123
<dependency>
124-
<groupId>junit</groupId>
125-
<artifactId>junit</artifactId>
126-
<version>4.13.2</version>
124+
<groupId>tech.ydb.test</groupId>
125+
<artifactId>ydb-junit5-support</artifactId>
126+
<scope>test</scope>
127+
<exclusions>
128+
<exclusion>
129+
<groupId>junit</groupId>
130+
<artifactId>junit</artifactId>
131+
</exclusion>
132+
</exclusions>
133+
</dependency>
134+
<dependency>
135+
<groupId>org.junit.jupiter</groupId>
136+
<artifactId>junit-jupiter-api</artifactId>
137+
<version>5.13.3</version>
138+
<scope>test</scope>
139+
</dependency>
140+
<dependency>
141+
<groupId>org.testcontainers</groupId>
142+
<artifactId>junit-jupiter</artifactId>
143+
<version>1.21.3</version>
144+
<scope>test</scope>
145+
</dependency>
146+
<dependency>
147+
<groupId>org.testcontainers</groupId>
148+
<artifactId>postgresql</artifactId>
149+
<version>1.21.3</version>
127150
<scope>test</scope>
128151
</dependency>
129152
</dependencies>
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
package tech.ydb.importer.config;
22

33
import java.io.File;
4-
import org.junit.Assert;
5-
import org.junit.Test;
4+
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.Test;
66
import static tech.ydb.importer.config.JdomHelper.*;
77

88
/**
99
*
1010
* @author zinal
1111
*/
1212
public class ImporterConfigTest {
13-
13+
1414
@Test
1515
public void checkLoad() throws Exception {
1616
final ImporterConfig ic = new ImporterConfig(
1717
readDocument( new File("scripts", "sample-oracle.xml") ));
18-
Assert.assertNotNull("missing source", ic.getSource());
19-
Assert.assertEquals(SourceType.ORACLE, ic.getSource().getType());
20-
Assert.assertNotNull("missing source URL", ic.getSource().getJdbcUrl());
21-
Assert.assertNotNull("missing source class", ic.getSource().getClassName());
22-
Assert.assertNotNull("missing source username", ic.getSource().getUserName());
23-
Assert.assertNotNull("missing source password", ic.getSource().getPassword());
24-
Assert.assertNotNull("missing target", ic.getTarget());
25-
Assert.assertEquals(TargetType.YDB, ic.getTarget().getType());
26-
Assert.assertNotNull("missing target script config", ic.getTarget().getScript());
27-
Assert.assertNotNull("missing target script filename", ic.getTarget().getScript().getFileName());
28-
Assert.assertFalse("empty target script filename",
29-
isBlank(ic.getTarget().getScript().getFileName()));
18+
Assertions.assertNotNull(ic.getSource(), "missing source");
19+
Assertions.assertEquals(SourceType.ORACLE, ic.getSource().getType());
20+
Assertions.assertNotNull(ic.getSource().getJdbcUrl(), "missing source URL");
21+
Assertions.assertNotNull(ic.getSource().getClassName(), "missing source class");
22+
Assertions.assertNotNull(ic.getSource().getUserName(), "missing source username");
23+
Assertions.assertNotNull(ic.getSource().getPassword(), "missing source password");
24+
Assertions.assertNotNull(ic.getTarget(), "missing target");
25+
Assertions.assertEquals(TargetType.YDB, ic.getTarget().getType());
26+
Assertions.assertNotNull(ic.getTarget().getScript(), "missing target script config");
27+
Assertions.assertNotNull(ic.getTarget().getScript().getFileName(), "missing target script filename");
28+
Assertions.assertFalse(isBlank(ic.getTarget().getScript().getFileName()), "empty target script filename");
3029
}
31-
30+
3231
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package tech.ydb.importer.integration;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.BeforeAll;
5+
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.api.extension.RegisterExtension;
7+
import org.testcontainers.containers.PostgreSQLContainer;
8+
import tech.ydb.test.junit5.YdbHelperExtension;
9+
10+
/**
11+
*
12+
* @author mzinal
13+
*/
14+
public class PgToYdbTest {
15+
16+
@RegisterExtension
17+
private static final YdbHelperExtension ydb = new YdbHelperExtension();
18+
19+
private static PostgreSQLContainer pg = new PostgreSQLContainer("postgres:17.5")
20+
.withDatabaseName("integration-tests-db")
21+
.withUsername("sa")
22+
.withPassword("sa");
23+
24+
@BeforeAll
25+
public static void init() {
26+
pg.start();
27+
}
28+
29+
@Test
30+
public void conversion() {
31+
32+
}
33+
34+
}

src/test/java/tech/ydb/importer/target/YdbTableBuilderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tech.ydb.importer.target;
22

3-
import org.junit.Test;
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
45
import tech.ydb.importer.TableDecision;
56
import tech.ydb.importer.source.*;
67
import tech.ydb.importer.config.*;

0 commit comments

Comments
 (0)