Skip to content

Commit bc77211

Browse files
authored
fix windows bug (#1201)
* fix windows bug * update * update
1 parent a485bd8 commit bc77211

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+133
-121
lines changed

.github/workflows/verify_build.yml

+51-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
test_java_11:
15-
name: Assert tests and javadoc with java 11
15+
name: Assert tests and javadoc with Java 11 on Ubuntu
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
@@ -34,13 +34,11 @@ jobs:
3434
file: jacoco.xml
3535
name: codecov
3636
token: ${{ secrets.CODECOV_TOKEN }}
37-
# tags: coverage
38-
37+
3938
test_java_8:
40-
name: Assert tests with java 8
39+
name: Assert tests with Java 8 on Ubuntu
4140
runs-on: ubuntu-latest
4241
needs: test_java_11
43-
4442
steps:
4543
- uses: actions/checkout@v4
4644
- name: Set up JDK 8
@@ -52,9 +50,8 @@ jobs:
5250
- name: Run tests
5351
run: mvn -B test --file pomJava8.xml -ntp
5452

55-
5653
test_java_21:
57-
name: Assert tests with java 21
54+
name: Assert tests with Java 21 on Ubuntu
5855
runs-on: ubuntu-latest
5956
steps:
6057
- uses: actions/checkout@v4
@@ -68,3 +65,50 @@ jobs:
6865
run: mvn javadoc:javadoc
6966
- name: Run tests
7067
run: mvn -B test --file pomJava21.xml -ntp
68+
69+
test_java_11_windows:
70+
name: Assert tests with Java 11 on Windows
71+
runs-on: windows-latest
72+
steps:
73+
- uses: actions/checkout@v4
74+
- name: Set up JDK 11
75+
uses: actions/setup-java@v4
76+
with:
77+
distribution: 'temurin'
78+
java-version: '11'
79+
cache: 'maven'
80+
- name: Generate javadoc
81+
run: mvn javadoc:javadoc
82+
- name: Run tests
83+
run: mvn -B test --file pom.xml -ntp
84+
85+
test_java_8_windows:
86+
name: Assert tests with Java 8 on Windows
87+
runs-on: windows-latest
88+
needs: test_java_11_windows
89+
steps:
90+
- uses: actions/checkout@v4
91+
- name: Set up JDK 8
92+
uses: actions/setup-java@v4
93+
with:
94+
distribution: 'temurin'
95+
java-version: '8'
96+
cache: 'maven'
97+
- name: Run tests
98+
run: mvn -B test --file pomJava8.xml -ntp
99+
100+
test_java_21_windows:
101+
name: Assert tests with Java 21 on Windows
102+
runs-on: windows-latest
103+
steps:
104+
- uses: actions/checkout@v4
105+
- name: Set up JDK 21
106+
uses: actions/setup-java@v4
107+
with:
108+
distribution: 'temurin'
109+
java-version: '21'
110+
cache: 'maven'
111+
- name: Generate javadoc
112+
run: mvn javadoc:javadoc
113+
- name: Run tests
114+
run: mvn -B test --file pomJava21.xml -ntp

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
<configuration>
203203
<rules>
204204
<requireMavenVersion>
205-
<version>3.8.8</version>
205+
<version>3.8.7</version>
206206
</requireMavenVersion>
207207
</rules>
208208
</configuration>

pomJava21.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<configuration>
133133
<rules>
134134
<requireMavenVersion>
135-
<version>3.8.8</version>
135+
<version>3.8.7</version>
136136
</requireMavenVersion>
137137
</rules>
138138
</configuration>

pomJava8.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<configuration>
133133
<rules>
134134
<requireMavenVersion>
135-
<version>3.8.8</version>
135+
<version>3.8.7</version>
136136
</requireMavenVersion>
137137
</rules>
138138
</configuration>

src/main/java/neqsim/util/database/NeqSimDataBase.java

+11-14
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public NeqSimDataBase() {
7272
* </p>
7373
*
7474
* @return a Connection object
75-
* @throws java.sql.SQLException if any.
75+
* @throws java.sql.SQLException if any.
7676
* @throws java.lang.ClassNotFoundException if any.
7777
*/
7878
public Connection openConnection() throws SQLException, ClassNotFoundException {
@@ -163,7 +163,8 @@ public void setStatement(Statement statement) {
163163
* </p>
164164
*
165165
* @param sqlString Query to execute.
166-
* @return True if the first result is a ResultSet object; false if it is an update count or there
166+
* @return True if the first result is a ResultSet object; false if it is an
167+
* update count or there
167168
* are no results
168169
*/
169170
public boolean execute(String sqlString) {
@@ -286,7 +287,7 @@ public static void setDataBaseType(String aDataBaseType) {
286287
* Setter for the field <code>dataBaseType</code>.
287288
* </p>
288289
*
289-
* @param aDataBaseType a {@link java.lang.String} object
290+
* @param aDataBaseType a {@link java.lang.String} object
290291
* @param connectionString a {@link java.lang.String} object
291292
*/
292293
public static void setDataBaseType(String aDataBaseType, String connectionString) {
@@ -402,8 +403,7 @@ public static String[] getComponentNames() {
402403
*/
403404
public static boolean hasComponent(String name) {
404405
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase();
405-
java.sql.ResultSet dataSet =
406-
database.getResultSet("select count(*) from comp WHERE NAME='" + name + "'")) {
406+
java.sql.ResultSet dataSet = database.getResultSet("select count(*) from comp WHERE NAME='" + name + "'")) {
407407
dataSet.next();
408408
int size = dataSet.getInt(1);
409409
if (size == 0) {
@@ -424,8 +424,7 @@ public static boolean hasComponent(String name) {
424424
*/
425425
public static boolean hasTempComponent(String name) {
426426
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase();
427-
java.sql.ResultSet dataSet =
428-
database.getResultSet("select count(*) from comptemp WHERE NAME='" + name + "'")) {
427+
java.sql.ResultSet dataSet = database.getResultSet("select count(*) from comptemp WHERE NAME='" + name + "'")) {
429428
dataSet.next();
430429
int size = dataSet.getInt(1);
431430
if (size == 0) {
@@ -451,7 +450,7 @@ public static void updateTable(String tableName) {
451450
* Drops and re-creates table from contents in csv file.
452451
*
453452
* @param tableName Name of table to replace
454-
* @param path Path to csv file to get table data from
453+
* @param path Path to csv file to get table data from
455454
*/
456455
public static void updateTable(String tableName, String path) {
457456
URL url = NeqSimDataBase.class.getClassLoader().getResource(path);
@@ -461,7 +460,7 @@ public static void updateTable(String tableName, String path) {
461460
}
462461
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
463462
database.execute("DROP TABLE IF EXISTS " + tableName);
464-
String sqlString = "CREATE TABLE " + tableName + " AS SELECT * FROM CSVREAD('" + url + "')";
463+
String sqlString = "CREATE TABLE " + tableName + " AS SELECT * FROM CSVREAD('file:" + url + "')";
465464
database.execute(sqlString);
466465
} catch (Exception ex) {
467466
logger.error("Failed updating table " + tableName, ex);
@@ -472,7 +471,7 @@ public static void updateTable(String tableName, String path) {
472471
* Drops and re-creates table from contents in csv file.
473472
*
474473
* @param tableName Name of table to replace
475-
* @param path Path to csv file to
474+
* @param path Path to csv file to
476475
*/
477476
public static void replaceTable(String tableName, String path) {
478477
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
@@ -494,8 +493,7 @@ public static void replaceTable(String tableName, String path) {
494493
*/
495494
public static void initH2DatabaseFromCSVfiles() {
496495
h2IsInitalizing = true;
497-
neqsim.util.database.NeqSimDataBase.connectionString =
498-
"jdbc:h2:mem:neqsimthermodatabase;DB_CLOSE_DELAY=-1";
496+
neqsim.util.database.NeqSimDataBase.connectionString = "jdbc:h2:mem:neqsimthermodatabase;DB_CLOSE_DELAY=-1";
499497
neqsim.util.database.NeqSimDataBase.dataBaseType = "H2";
500498

501499
try {
@@ -539,8 +537,7 @@ public static void initH2DatabaseFromCSVfiles() {
539537
// technicalrequirements, technicalrequirements_process, materialpipeproperties,
540538
// materialplateproperties, fittings, LuciaData, Luciadata8
541539

542-
try (neqsim.util.database.NeqSimDataBase database =
543-
new neqsim.util.database.NeqSimDataBase()) {
540+
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
544541
database.execute("CREATE TABLE comptemp AS SELECT * FROM comp");
545542
database.execute("CREATE TABLE intertemp AS SELECT * FROM inter");
546543
}

0 commit comments

Comments
 (0)