Skip to content

Commit 047a195

Browse files
committed
removed eclipse legacy
1 parent 94445c5 commit 047a195

File tree

3 files changed

+57
-36
lines changed

3 files changed

+57
-36
lines changed

pom.xml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@
6060
<artifactId>slf4j-api</artifactId>
6161
<version>2.0.17</version>
6262
</dependency>
63-
<dependency>
64-
<groupId>args4j</groupId>
65-
<artifactId>args4j</artifactId>
66-
<version>2.37</version>
67-
</dependency>
68-
<dependency>
69-
<groupId>org.eclipse.platform</groupId>
70-
<artifactId>org.eclipse.core.runtime</artifactId>
71-
<version>3.33.100</version>
72-
</dependency>
7363
<dependency>
7464
<groupId>org.antlr</groupId>
7565
<artifactId>antlr4-runtime</artifactId>
@@ -94,13 +84,13 @@
9484
<dependency>
9585
<groupId>com.clickhouse</groupId>
9686
<artifactId>clickhouse-jdbc</artifactId>
97-
<version>0.4.2</version>
87+
<version>0.4.6</version>
9888
</dependency>
9989

10090
<dependency>
10191
<groupId>org.junit.jupiter</groupId>
10292
<artifactId>junit-jupiter</artifactId>
103-
<version>5.11.3</version>
93+
<version>5.13.4</version>
10494
<scope>test</scope>
10595
</dependency>
10696
</dependencies>
@@ -197,5 +187,33 @@
197187
</plugins>
198188
</build>
199189
</profile>
190+
191+
<profile>
192+
<id>jenkins</id>
193+
<build>
194+
<plugins>
195+
<plugin>
196+
<groupId>org.jacoco</groupId>
197+
<artifactId>jacoco-maven-plugin</artifactId>
198+
<version>0.8.13</version>
199+
<executions>
200+
<execution>
201+
<id>prepare-agent</id>
202+
<goals>
203+
<goal>prepare-agent</goal>
204+
</goals>
205+
</execution>
206+
<execution>
207+
<id>report</id>
208+
<phase>test</phase>
209+
<goals>
210+
<goal>report</goal>
211+
</goals>
212+
</execution>
213+
</executions>
214+
</plugin>
215+
</plugins>
216+
</build>
217+
</profile>
200218
</profiles>
201219
</project>

src/main/java/org/pgcodekeeper/core/localizations/Messages.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*******************************************************************************/
1616
package org.pgcodekeeper.core.localizations;
1717

18-
import org.eclipse.osgi.util.NLS;
18+
import java.lang.reflect.Field;
19+
import java.util.ResourceBundle;
1920

2021
/**
2122
* Internationalization message constants for pgCodeKeeper core components.
@@ -24,10 +25,10 @@
2425
* error messages, log entries, and other text content throughout the pgCodeKeeper
2526
* core library.
2627
*/
27-
public final class Messages extends NLS {
28+
public final class Messages {
29+
2830
public static final String BUNDLE_NAME = "org.pgcodekeeper.core.localizations.messages"; //$NON-NLS-1$
2931

30-
// SONAR-OFF
3132
public static String Version;
3233

3334
public static String AbstractAnalysisLauncher_error_prefix;
@@ -238,11 +239,19 @@ public final class Messages extends NLS {
238239

239240
public static String DatabaseFactory_errors_found_while_parsing;
240241

241-
// SONAR-ON
242-
243242
static {
244-
// initialize resource bundle
245-
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
243+
// TODO replace with ENUM
244+
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME);
245+
for (String key : bundle.keySet()) {
246+
try {
247+
Field field = Messages.class.getField(key);
248+
if (field.getType().equals(String.class)) {
249+
field.set(null, bundle.getString(key));
250+
}
251+
} catch (NoSuchFieldException | IllegalAccessException e) {
252+
// ignore
253+
}
254+
}
246255
}
247256

248257
private Messages() {

src/test/java/org/pgcodekeeper/core/TestUtils.java

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@
1515
*******************************************************************************/
1616
package org.pgcodekeeper.core;
1717

18-
import org.eclipse.core.runtime.FileLocator;
19-
import org.eclipse.core.runtime.URIUtil;
2018
import org.junit.jupiter.api.Assertions;
2119
import org.pgcodekeeper.core.loader.DatabaseLoader;
2220
import org.pgcodekeeper.core.loader.PgDumpLoader;
23-
import org.pgcodekeeper.core.localizations.Messages;
2421
import org.pgcodekeeper.core.model.difftree.DbObjType;
2522
import org.pgcodekeeper.core.model.difftree.DiffTree;
2623
import org.pgcodekeeper.core.model.difftree.TreeElement;
@@ -80,7 +77,6 @@ public static AbstractDatabase createDumpDB(DatabaseType dbType) {
8077
case PG -> new PgSchema(Consts.PUBLIC);
8178
case MS -> new MsSchema(Consts.DBO);
8279
case CH -> new ChSchema(Consts.CH_DEFAULT_DB);
83-
default -> throw new IllegalArgumentException(Messages.DatabaseType_unsupported_type + dbType);
8480
};
8581
db.addSchema(schema);
8682
db.setDefaultSchema(schema.getName());
@@ -126,9 +122,9 @@ public static void createIgnoreListFile(Path dir) throws IOException {
126122
Files.writeString(dir.resolve(".pgcodekeeperignore"), rule);
127123
}
128124

129-
public static Path getPathToResource(String resourceName, Class<?> clazz) throws URISyntaxException, IOException {
125+
public static Path getPathToResource(String resourceName, Class<?> clazz) throws URISyntaxException {
130126
URL url = clazz.getResource(resourceName);
131-
return Paths.get(URIUtil.toURI("file".equals(url.getProtocol()) ? url : FileLocator.toFileURL(url)));
127+
return Paths.get(url.toURI());
132128
}
133129

134130
static void runDiff(String fileNameTemplate, DatabaseType dbType, Class<?> clazz) throws IOException, InterruptedException {
@@ -173,24 +169,22 @@ public static void testDepcy(String dbTemplate, String userTemplateName, Map<Str
173169

174170
/**
175171
* In this method we simulate user behavior where he selected some objects, all
176-
* or noone.
172+
* or none.
177173
*
178-
* @param selectedObjs - {@link Map} selected objects, where key - name of
179-
* object, value - {@link DbObjType} of object. If is null
180-
* user select all objects
181-
* @param tree - {@link TreeElement} after diff old and new database
182-
* state
183-
* @param oldDbFull - old state of {@link AbstractDatabase}
184-
* @param newDbFull - new state of {@link AbstractDatabase}
174+
* @param selectedObjects - {@link Map} selected objects, where key - name of object, value - {@link DbObjType} of
175+
* object. If is null user select all objects
176+
* @param tree - {@link TreeElement} after diff old and new database state
177+
* @param oldDbFull - old state of {@link AbstractDatabase}
178+
* @param newDbFull - new state of {@link AbstractDatabase}
185179
*/
186-
private static void setSelected(Map<String, DbObjType> selectedObjs, TreeElement tree, AbstractDatabase oldDbFull,
180+
private static void setSelected(Map<String, DbObjType> selectedObjects, TreeElement tree, AbstractDatabase oldDbFull,
187181
AbstractDatabase newDbFull) {
188-
if (null == selectedObjs) {
182+
if (null == selectedObjects) {
189183
tree.setAllChecked();
190184
return;
191185
}
192186

193-
for (var sel : selectedObjs.entrySet()) {
187+
for (var sel : selectedObjects.entrySet()) {
194188
String[] arr = Arrays.copyOf(sel.getKey().split("-"), 3);
195189
var col = new GenericColumn(arr[0], arr[1], arr[2], sel.getValue());
196190
var stmt = newDbFull.getStatement(col);

0 commit comments

Comments
 (0)