Tony CHEMIT pushed to branch master-5.x at ultreiaio / ird-observe
Commits:
-
055d730b
by Tony CHEMIT at 2017-06-13T19:49:38+02:00
-
ed4c99ab
by Tony CHEMIT at 2017-06-13T20:26:28+02:00
-
f06dc420
by Tony CHEMIT at 2017-06-13T20:26:29+02:00
-
b92b1481
by Tony CHEMIT at 2017-06-13T20:26:30+02:00
-
1752e3b8
by Tony CHEMIT at 2017-06-13T21:58:35+02:00
-
e07a9ea9
by Tony CHEMIT at 2017-06-13T21:59:07+02:00
-
115b23c0
by Tony CHEMIT at 2017-06-13T22:05:24+02:00
-
0a49fab0
by Tony CHEMIT at 2017-06-13T22:07:12+02:00
-
c6a793a8
by Tony CHEMIT at 2017-06-13T22:32:25+02:00
-
db71e851
by Tony CHEMIT at 2017-06-13T22:39:54+02:00
-
61b5b4a0
by Tony CHEMIT at 2017-06-13T23:26:58+02:00
-
790cc1db
by Tony CHEMIT at 2017-06-13T23:27:18+02:00
-
e3c73e79
by Tony CHEMIT at 2017-06-13T23:27:33+02:00
-
54357830
by Tony CHEMIT at 2017-06-13T23:44:45+02:00
7 changed files:
- .gitlab-ci.yml
- application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveMultipleDataUIActionSupport.java
- application-swing/src/main/java/fr/ird/observe/application/swing/ui/actions/shared/MoveSingleDataUIActionSupport.java
- + entities/src/test/java/fr/ird/observe/H2TimeZoneTest.java
- pom.xml
- services-configuration-topia/src/main/java/fr/ird/observe/services/configuration/topia/ObserveDataSourceConfigurationTopiaH2.java
- services-topia/src/test/java/fr/ird/observe/services/topia/service/MigrateTestsDatabases.java
Changes:
| ... | ... | @@ -82,6 +82,7 @@ stage: |
| 82 | 82 |
<<: *test_manual
|
| 83 | 83 |
<<: *before_script_clone
|
| 84 | 84 |
script:
|
| 85 |
+ - git checkout develop-5.x
|
|
| 85 | 86 |
- apt-get update -y && apt-get install libc6-i386 libx32stdc++6 -y
|
| 86 | 87 |
- wget -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/close-milestone.sh | bash
|
| 87 | 88 |
- wget -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/create-stage.sh | bash
|
| ... | ... | @@ -89,7 +90,7 @@ stage: |
| 89 | 90 |
- wget -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/create-milestone.sh | bash
|
| 90 | 91 |
- wget -O - https://gitlab.com/ultreiaio/pom/raw/master/bin/close-stage.sh | sed 's/$1/frirdobserve/' | bash
|
| 91 | 92 |
|
| 92 |
-deploy-snapshot:
|
|
| 93 |
+latest-snapshot:
|
|
| 93 | 94 |
<<: *env_staging
|
| 94 | 95 |
<<: *test_manual
|
| 95 | 96 |
script:
|
| 1 | 1 |
package fr.ird.observe.application.swing.ui.actions.shared;
|
| 2 | 2 |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Application Swing
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 3 | 25 |
import fr.ird.observe.application.swing.ObserveSwingApplicationContext;
|
| 4 | 26 |
import fr.ird.observe.application.swing.ui.ObserveMainUI;
|
| 5 | 27 |
import fr.ird.observe.application.swing.ui.content.ContentUI;
|
| 1 | 1 |
package fr.ird.observe.application.swing.ui.actions.shared;
|
| 2 | 2 |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Application Swing
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 3 | 25 |
import fr.ird.observe.application.swing.ObserveOpenDataManager;
|
| 4 | 26 |
import fr.ird.observe.application.swing.ObserveSwingApplicationContext;
|
| 5 | 27 |
import fr.ird.observe.application.swing.ui.ObserveMainUI;
|
| 1 |
+package fr.ird.observe;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Entities
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2017 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import java.io.IOException;
|
|
| 26 |
+import java.nio.file.Files;
|
|
| 27 |
+import java.nio.file.Path;
|
|
| 28 |
+import java.nio.file.Paths;
|
|
| 29 |
+import java.sql.Connection;
|
|
| 30 |
+import java.sql.Date;
|
|
| 31 |
+import java.sql.DriverManager;
|
|
| 32 |
+import java.sql.PreparedStatement;
|
|
| 33 |
+import java.sql.ResultSet;
|
|
| 34 |
+import java.sql.SQLException;
|
|
| 35 |
+import java.util.Calendar;
|
|
| 36 |
+import java.util.TimeZone;
|
|
| 37 |
+import org.junit.Assert;
|
|
| 38 |
+import org.junit.BeforeClass;
|
|
| 39 |
+import org.junit.Test;
|
|
| 40 |
+ |
|
| 41 |
+/**
|
|
| 42 |
+ * Created by tchemit on 13/06/17.
|
|
| 43 |
+ *
|
|
| 44 |
+ * @author Tony Chemit - dev@tchemit.fr
|
|
| 45 |
+ */
|
|
| 46 |
+public class H2TimeZoneTest {
|
|
| 47 |
+ |
|
| 48 |
+ public static final TimeZone TIME_ZONE = TimeZone.getTimeZone("Europe/Paris");
|
|
| 49 |
+ static String JDBC_URL;
|
|
| 50 |
+ static Path path;
|
|
| 51 |
+ static java.util.Date expectedDate;
|
|
| 52 |
+ |
|
| 53 |
+ @BeforeClass
|
|
| 54 |
+ public static void beforeClass() throws IOException, SQLException {
|
|
| 55 |
+ |
|
| 56 |
+ Path dir = Paths.get(System.getProperty("java.io.tmpdir"));
|
|
| 57 |
+ Files.createDirectories(dir);
|
|
| 58 |
+ |
|
| 59 |
+ path = dir.resolve("H2TimeZoneTest-" + System.nanoTime());
|
|
| 60 |
+ Files.createDirectories(path);
|
|
| 61 |
+ JDBC_URL = String.format("jdbc:h2:file:%s/test", path.toFile().getAbsolutePath());
|
|
| 62 |
+ |
|
| 63 |
+ Calendar calendar = Calendar.getInstance();
|
|
| 64 |
+ calendar.set(Calendar.YEAR, 2016);
|
|
| 65 |
+ calendar.set(Calendar.MONTH, 1);
|
|
| 66 |
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
| 67 |
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
| 68 |
+ calendar.set(Calendar.MINUTE, 0);
|
|
| 69 |
+ calendar.set(Calendar.SECOND, 0);
|
|
| 70 |
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
| 71 |
+ |
|
| 72 |
+ expectedDate = calendar.getTime();
|
|
| 73 |
+ |
|
| 74 |
+ |
|
| 75 |
+ try (Connection connection = DriverManager.getConnection(JDBC_URL)) {
|
|
| 76 |
+ try (PreparedStatement preparedStatement = connection.prepareStatement("CREATE TABLE test (simpleDate DATE)")) {
|
|
| 77 |
+ preparedStatement.execute();
|
|
| 78 |
+ }
|
|
| 79 |
+ |
|
| 80 |
+ try (PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO test VALUES( ? );")) {
|
|
| 81 |
+ |
|
| 82 |
+ preparedStatement.setDate(1, new java.sql.Date(expectedDate.getTime()));
|
|
| 83 |
+ preparedStatement.execute();
|
|
| 84 |
+ }
|
|
| 85 |
+ connection.commit();
|
|
| 86 |
+ }
|
|
| 87 |
+ }
|
|
| 88 |
+ |
|
| 89 |
+ @Test
|
|
| 90 |
+ public void testWithDefaultTimeZone() {
|
|
| 91 |
+ |
|
| 92 |
+ TimeZone.setDefault(TIME_ZONE);
|
|
| 93 |
+ try (Connection connection = DriverManager.getConnection(JDBC_URL)) {
|
|
| 94 |
+ try (PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM test LIMIT 1;")) {
|
|
| 95 |
+ try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
|
| 96 |
+ boolean next = resultSet.next();
|
|
| 97 |
+ Date actualDate = resultSet.getDate(1);
|
|
| 98 |
+ Assert.assertEquals(expectedDate, actualDate);
|
|
| 99 |
+ }
|
|
| 100 |
+ }
|
|
| 101 |
+ connection.commit();
|
|
| 102 |
+ } catch (SQLException e) {
|
|
| 103 |
+ e.printStackTrace();
|
|
| 104 |
+ }
|
|
| 105 |
+ }
|
|
| 106 |
+ |
|
| 107 |
+ @Test
|
|
| 108 |
+ public void testWithUtcTimeZone() {
|
|
| 109 |
+ |
|
| 110 |
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
|
|
| 111 |
+ try (Connection connection = DriverManager.getConnection(JDBC_URL)) {
|
|
| 112 |
+ try (PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM test LIMIT 1;")) {
|
|
| 113 |
+ try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
|
| 114 |
+ boolean next = resultSet.next();
|
|
| 115 |
+ Date actualDate = resultSet.getDate(1);
|
|
| 116 |
+ Assert.assertEquals(expectedDate, actualDate);
|
|
| 117 |
+ }
|
|
| 118 |
+ }
|
|
| 119 |
+ connection.commit();
|
|
| 120 |
+ } catch (SQLException e) {
|
|
| 121 |
+ e.printStackTrace();
|
|
| 122 |
+ }
|
|
| 123 |
+ }
|
|
| 124 |
+}
|
| ... | ... | @@ -546,9 +546,7 @@ |
| 546 | 546 |
<dependency>
|
| 547 | 547 |
<groupId>com.h2database</groupId>
|
| 548 | 548 |
<artifactId>h2</artifactId>
|
| 549 |
- <!-- tc20150811 On ne pleut pas utiliser une version plus récente, le format n'est pas compatible -->
|
|
| 550 |
- <!-- FIXME Hum je ne suis pas sur que la 176 soit ok. -->
|
|
| 551 |
- <version>1.3.175</version>
|
|
| 549 |
+ <version>1.4.195</version>
|
|
| 552 | 550 |
</dependency>
|
| 553 | 551 |
|
| 554 | 552 |
<dependency>
|
| ... | ... | @@ -58,7 +58,7 @@ public class ObserveDataSourceConfigurationTopiaH2 extends ObserveDataSourceConf |
| 58 | 58 |
}
|
| 59 | 59 |
|
| 60 | 60 |
public File getDatabaseFile() {
|
| 61 |
- return new File(directory, dbName + ".h2.db");
|
|
| 61 |
+ return new File(directory, dbName + ".mv.db");
|
|
| 62 | 62 |
}
|
| 63 | 63 |
|
| 64 | 64 |
public File getLockFile() {
|
| ... | ... | @@ -117,7 +117,7 @@ public class MigrateTestsDatabases extends AbstractServiceTopiaTest { |
| 117 | 117 |
|
| 118 | 118 |
File databasesRootDirectory = topiaTestMethodResource.getDataSourceConfiguration().getDatabaseFile();
|
| 119 | 119 |
|
| 120 |
- while (!"observe".equals(databasesRootDirectory.getName())) {
|
|
| 120 |
+ while (!"ird-observe".equals(databasesRootDirectory.getName())) {
|
|
| 121 | 121 |
databasesRootDirectory = databasesRootDirectory.getParentFile();
|
| 122 | 122 |
}
|
| 123 | 123 |
|