Skip to content

Commit 789d21f

Browse files
andrii0lomakintglman
authored andcommitted
Migration to JDK 21 and fixing of ETL bug in Windows.
1 parent 08a5bc2 commit 789d21f

File tree

30 files changed

+72
-100
lines changed

30 files changed

+72
-100
lines changed

.mvn/wrapper/maven-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
1+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip

client/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>com.orientechnologies</groupId>
2929
<artifactId>orientdb-parent</artifactId>
30-
<version>3.2.28-SNAPSHOT</version>
30+
<version>4.0.0-SNAPSHOT</version>
3131
<relativePath>../pom.xml</relativePath>
3232
</parent>
3333

core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>com.orientechnologies</groupId>
1818
<artifactId>orientdb-parent</artifactId>
19-
<version>3.2.28-SNAPSHOT</version>
19+
<version>4.0.0-SNAPSHOT</version>
2020
<relativePath>../pom.xml</relativePath>
2121
</parent>
2222

distributed/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>com.orientechnologies</groupId>
2929
<artifactId>orientdb-parent</artifactId>
30-
<version>3.2.28-SNAPSHOT</version>
30+
<version>4.0.0-SNAPSHOT</version>
3131
<relativePath>../pom.xml</relativePath>
3232
</parent>
3333

distribution-tp2/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>com.orientechnologies</groupId>
1818
<artifactId>orientdb-parent</artifactId>
19-
<version>3.2.28-SNAPSHOT</version>
19+
<version>4.0.0-SNAPSHOT</version>
2020
<relativePath>../</relativePath>
2121
</parent>
2222

distribution/pom.xml

+1-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>com.orientechnologies</groupId>
1818
<artifactId>orientdb-parent</artifactId>
19-
<version>3.2.28-SNAPSHOT</version>
19+
<version>4.0.0-SNAPSHOT</version>
2020
<relativePath>../pom.xml</relativePath>
2121
</parent>
2222

@@ -102,27 +102,6 @@
102102
<scope>test</scope>
103103
</dependency>
104104

105-
<!-- <dependency>-->
106-
<!-- <groupId>org.apache.logging.log4j</groupId>-->
107-
<!-- <artifactId>log4j-core</artifactId>-->
108-
<!-- <version>2.15.0</version>-->
109-
<!-- <scope>test</scope>-->
110-
<!-- </dependency>-->
111-
112-
<!-- <dependency>-->
113-
<!-- <groupId>org.apache.logging.log4j</groupId>-->
114-
<!-- <artifactId>log4j-jul</artifactId>-->
115-
<!-- <version>2.15.0</version>-->
116-
<!-- <scope>test</scope>-->
117-
<!-- </dependency>-->
118-
119-
<!-- <dependency>-->
120-
<!-- <groupId>org.apache.logging.log4j</groupId>-->
121-
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
122-
<!-- <version>2.15.0</version>-->
123-
<!-- <scope>test</scope>-->
124-
<!-- </dependency>-->
125-
126105
</dependencies>
127106
<build>
128107
<plugins>

etl/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>com.orientechnologies</groupId>
2424
<artifactId>orientdb-parent</artifactId>
25-
<version>3.2.28-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

etl/src/main/java/com/orientechnologies/orient/etl/OETLPlugin.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ public void executeJob(
5454
System.out.println("Syntax error, missing configuration file.");
5555
} else {
5656
String[] args = {outDBConfigPath};
57-
final OETLProcessor processor =
57+
try (final OETLProcessor processor =
5858
new OETLProcessorConfigurator()
59-
.parseConfigAndParametersWithContext(server.getContext(), args);
59+
.parseConfigAndParametersWithContext(server.getContext(), args)) {
6060

61-
try {
6261
// overriding default message handler if the chosen verbosity level is different from the
6362
// default one
6463
if (messageHandler.getOutputManagerLevel()
@@ -68,8 +67,6 @@ public void executeJob(
6867

6968
// execute the job
7069
processor.execute();
71-
} finally {
72-
processor.close();
7370
}
7471
}
7572
}
@@ -84,7 +81,9 @@ public void startup() {
8481

8582
final OServerNetworkListener listener =
8683
server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
87-
if (listener == null) throw new OConfigurationException("HTTP listener not found");
84+
if (listener == null) {
85+
throw new OConfigurationException("HTTP listener not found");
86+
}
8887

8988
listener.registerStatelessCommand(new OServerCommandETL());
9089
}

etl/src/main/java/com/orientechnologies/orient/etl/OETLProcessor.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
*
5353
* @author Luca Garulli (l.garulli--(at)--orientdb.com) (l.garulli-at-orientdb.com)
5454
*/
55-
public class OETLProcessor {
55+
public class OETLProcessor implements AutoCloseable {
5656
protected final OETLComponentFactory factory;
5757
protected final OETLProcessorStats stats;
5858
private final ExecutorService executor;
@@ -184,8 +184,6 @@ public void execute() {
184184
private void configure() {}
185185

186186
public void close() {
187-
loader.getPool().close();
188-
189187
loader.close();
190188
}
191189

etl/src/main/java/com/orientechnologies/orient/etl/context/OETLContext.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ public void setMessageHandler(OPluginMessageHandler messageHandler) {
7070
*/
7171
public String printExceptionMessage(Exception e, String message, String level) {
7272

73-
if (e.getMessage() != null) message += "\n" + e.getClass().getName() + " - " + e.getMessage();
74-
else message += "\n" + e.getClass().getName();
73+
if (e.getMessage() != null) {
74+
message += "\n" + e.getClass().getName() + " - " + e.getMessage();
75+
} else {
76+
message += "\n" + e.getClass().getName();
77+
}
7578

7679
switch (level) {
7780
case "debug":
@@ -125,8 +128,9 @@ public String printExceptionStackTrace(Exception e, String level) {
125128

126129
public synchronized void registerOrientDB(OrientDB orientdb) {
127130
OrientDBInternal orientDBInternal = OrientDBInternal.extract(orientdb);
128-
this.contexts.put(
129-
"embedded:" + orientDBInternal.getBasePath(), orientDBInternal.newOrientDBNoClose());
131+
132+
var dbBasePath = orientDBInternal.getBasePath().replace('\\', '/');
133+
this.contexts.put("embedded:" + dbBasePath, orientDBInternal.newOrientDBNoClose());
130134
}
131135

132136
public synchronized OrientDB getOrientDB(String url, String user, String password) {

etl/src/main/java/com/orientechnologies/orient/etl/loader/OETLLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import com.orientechnologies.orient.etl.OETLPipeline;
2626

2727
/** ETL Loader. */
28-
public interface OETLLoader extends OETLComponent {
28+
public interface OETLLoader extends OETLComponent, AutoCloseable {
2929

3030
void load(ODatabaseDocument db, final Object input, OCommandContext context);
3131

etl/src/test/java/com/orientechnologies/orient/etl/OETLBaseTest.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* @author Luca Garulli (l.garulli--(at)--orientdb.com)
3434
*/
3535
public abstract class OETLBaseTest {
36+
3637
@Rule public TestName name = new TestName();
3738

3839
protected String[] names =
@@ -46,7 +47,6 @@ public abstract class OETLBaseTest {
4647

4748
@Before
4849
public void configureProcessor() throws Throwable {
49-
5050
OLogManager.instance().installCustomFormatter();
5151
OETLComponentFactory factory =
5252
new OETLComponentFactory()
@@ -58,7 +58,10 @@ public void configureProcessor() throws Throwable {
5858

5959
@After
6060
public void closeResources() {
61-
if (proc != null) proc.close();
61+
if (proc != null) {
62+
proc.close();
63+
proc = null;
64+
}
6265
}
6366

6467
protected List<ODocument> getResult() {

etl/src/test/java/com/orientechnologies/orient/etl/OETLProcessorTest.java

+18-29
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static org.assertj.core.api.Assertions.assertThat;
2222

2323
import com.orientechnologies.common.io.OFileUtils;
24-
import com.orientechnologies.orient.etl.loader.OETLOrientDBLoader;
2524
import com.orientechnologies.orient.etl.transformer.OETLVertexTransformer;
2625
import java.io.File;
2726
import org.junit.Before;
@@ -30,7 +29,7 @@
3029
/** Created by frank on 9/18/15. */
3130
public class OETLProcessorTest extends OETLBaseTest {
3231

33-
private static final String databaseDir = "./target/databases/";
32+
private static final String databaseDir = "./target/databases/etlProcessor";
3433

3534
@Before
3635
public void setUp() throws Exception {
@@ -40,63 +39,53 @@ public void setUp() throws Exception {
4039
@Test
4140
public void testMain() throws Exception {
4241

43-
final OETLProcessor processor =
42+
try (OETLProcessor processor =
4443
new OETLProcessorConfigurator()
4544
.parseConfigAndParameters(
4645
new String[] {
4746
"-dbURL=plocal:" + databaseDir + "orientDBoetl/testMain",
4847
"./src/test/resources/comment.json"
49-
});
48+
})) {
5049

51-
assertThat(processor.getContext().getVariable("dbURL"))
52-
.isEqualTo("plocal:" + databaseDir + "orientDBoetl/testMain");
53-
54-
OETLOrientDBLoader loader = (OETLOrientDBLoader) processor.getLoader();
55-
loader.getPool().close();
56-
57-
loader.orient.close();
50+
assertThat(processor.getContext().getVariable("dbURL"))
51+
.isEqualTo("plocal:" + databaseDir + "orientDBoetl/testMain");
52+
}
5853
}
5954

6055
@Test
6156
public void shouldParseSplitConfiguration() throws Exception {
6257

63-
final OETLProcessor processor =
58+
try (OETLProcessor processor =
6459
new OETLProcessorConfigurator()
6560
.parseConfigAndParameters(
6661
new String[] {
6762
"-dbURL=plocal:" + databaseDir + "orientDBoetl/shouldParseSplitConfiguration",
6863
"./src/test/resources/comment_split_1.json",
6964
"./src/test/resources/comment_split_2.json"
70-
});
65+
})) {
7166

72-
assertThat(processor.getContext().getVariable("dbURL"))
73-
.isEqualTo("plocal:" + databaseDir + "orientDBoetl/shouldParseSplitConfiguration");
74-
assertThat(processor.getTransformers().get(0)).isInstanceOf(OETLVertexTransformer.class);
75-
assertThat(processor.getExtractor().getName()).isEqualTo("csv");
76-
OETLOrientDBLoader loader = (OETLOrientDBLoader) processor.getLoader();
77-
loader.getPool().close();
78-
79-
loader.orient.close();
67+
assertThat(processor.getContext().getVariable("dbURL"))
68+
.isEqualTo("plocal:" + databaseDir + "orientDBoetl/shouldParseSplitConfiguration");
69+
assertThat(processor.getTransformers().get(0)).isInstanceOf(OETLVertexTransformer.class);
70+
assertThat(processor.getExtractor().getName()).isEqualTo("csv");
71+
}
8072
}
8173

8274
@Test
8375
public void shouldExceuteBeginBlocktoExpandVariables() throws Exception {
8476

85-
final OETLProcessor processor =
77+
try (OETLProcessor processor =
8678
new OETLProcessorConfigurator()
8779
.parseConfigAndParameters(
8880
new String[] {
8981
"-dbURL=plocal:"
9082
+ databaseDir
9183
+ "orientDBoetl/shouldExceuteBeginBlocktoExpandVariables",
9284
"./src/test/resources/comment.json"
93-
});
94-
95-
assertThat(processor.context.getVariable("filePath"))
96-
.isEqualTo("./src/test/resources/comments.csv");
97-
OETLOrientDBLoader loader = (OETLOrientDBLoader) processor.getLoader();
98-
loader.getPool().close();
85+
})) {
9986

100-
loader.orient.close();
87+
assertThat(processor.context.getVariable("filePath"))
88+
.isEqualTo("./src/test/resources/comments.csv");
89+
}
10190
}
10291
}

etl/src/test/java/com/orientechnologies/orient/etl/OETLStubLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public OETLStubLoader() {}
4444
@Override
4545
public void beginLoader(OETLPipeline pipeline) {
4646

47-
orient = new OrientDB("embedded:", null);
47+
orient = new OrientDB("embedded:target/etlTests/", null);
4848

4949
orient.execute(
5050
"create database testDatabase memory users (admin identified by 'admin' role admin)");

etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLEdgeTransformerTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ public class OETLEdgeTransformerTest extends OETLBaseTest {
4949

5050
@Before
5151
public void cleanFs() throws Exception {
52-
OFileUtils.deleteRecursively(new File("./target/databases/"));
52+
OFileUtils.deleteRecursively(new File("./target/databases/etlEdgeTransformerTest"));
5353
}
5454

5555
@After
5656
public void tearDown() throws Exception {
5757
closeResources();
5858

59-
OFileUtils.deleteRecursively(new File("./target/databases/"));
59+
OFileUtils.deleteRecursively(new File("./target/databases/etlEdgeTransformerTest"));
6060
}
6161

6262
public void createClasses(ODatabaseDocument db) {
@@ -239,7 +239,7 @@ public void testVertexAndEdgesOnSeparatedFiles() {
239239
configure(
240240
"{source: { content: { value: 'id,name\n1,Luigi\n2,Luca\n3,Enrico\n4,Franco\n5,Gianni' } }, extractor : { csv: {} },"
241241
+ " transformers: [ {merge: {joinFieldName:'id',lookup:'PersonMF.id'}}, {vertex: {class:'PersonMF'}}"
242-
+ "], loader: { orientdb: { dbURL: 'plocal:./target/databases/"
242+
+ "], loader: { orientdb: { dbURL: 'plocal:./target/databases/etlEdgeTransformerTest"
243243
+ name.getMethodName()
244244
+ "', dbType:'graph', classes: [{name:'PersonMF',extends:'V'}] } } }");
245245

@@ -272,7 +272,7 @@ public void testVertexAndEdgesOnSeparatedFiles() {
272272
+ "{vertex: {class:'PersonMF'}},"
273273
+ "{edge:{class:'FriendMF',joinFieldName:'friend_to',lookup:'PersonMF.id',edgeFields:{since:'${input.since}'} }},"
274274
+ "{field: {operation:'remove', fieldNames:['friend_from','friend_to','since']}}"
275-
+ "], loader: { orientdb: { dbURL: 'plocal:./target/databases/"
275+
+ "], loader: { orientdb: { dbURL: 'plocal:./target/databases/etlEdgeTransformerTest"
276276
+ name.getMethodName()
277277
+ "', dbType:'graph', classes: [{name:'FriendMF',extends:'E'}] } } }");
278278

etl/src/test/java/com/orientechnologies/orient/etl/transformer/OETLVertexTransformerTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public void testCreateVertex() {
6464
assertEquals("person", 1, db.countClass("Person"));
6565

6666
assertThat(db.countClusterElements("custom")).isEqualTo(1);
67+
db.close();
6768
}
6869

6970
@Test

etl/src/test/resources/orientdb-simple-dserver-config-0.xml

100755100644
+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
name="replicator"/>
3232
</users>
3333
<properties>
34-
<entry name="server.database.path" value="target/server0/"/>
34+
<entry name="server.database.path" value="target/etlJobTest/server0/"/>
3535
</properties>
3636
<isAfterFirstTime>true</isAfterFirstTime>
3737
</orient-server>

graphdb/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>com.orientechnologies</groupId>
2525
<artifactId>orientdb-parent</artifactId>
26-
<version>3.2.28-SNAPSHOT</version>
26+
<version>4.0.0-SNAPSHOT</version>
2727
<relativePath>../pom.xml</relativePath>
2828
</parent>
2929

jdbc/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>com.orientechnologies</groupId>
2424
<artifactId>orientdb-parent</artifactId>
25-
<version>3.2.28-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

jdbc/src/test/java/com/orientechnologies/orient/jdbc/OrientJdbcDatabaseMetaDataTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ public void verifyDriverAndDatabaseVersions() throws SQLException {
5353
assertEquals("admin", metaData.getUserName());
5454
assertEquals("OrientDB", metaData.getDatabaseProductName());
5555
assertEquals(OConstants.getVersion(), metaData.getDatabaseProductVersion());
56-
assertEquals(3, metaData.getDatabaseMajorVersion());
57-
assertEquals(2, metaData.getDatabaseMinorVersion());
56+
assertEquals(4, metaData.getDatabaseMajorVersion());
57+
assertEquals(0, metaData.getDatabaseMinorVersion());
5858

5959
assertEquals("OrientDB JDBC Driver", metaData.getDriverName());
6060
assertEquals(
6161
"OrientDB " + OConstants.getVersion() + " JDBC Driver", metaData.getDriverVersion());
62-
assertEquals(3, metaData.getDriverMajorVersion());
63-
assertEquals(2, metaData.getDriverMinorVersion());
62+
assertEquals(4, metaData.getDriverMajorVersion());
63+
assertEquals(0, metaData.getDriverMinorVersion());
6464
}
6565

6666
@Test

0 commit comments

Comments
 (0)