update to Gradle 8.5, use datastructures for json
Some checks failed
CodeQL / Analyze (push) Has been cancelled

This commit is contained in:
Jörg Prante 2023-12-12 21:11:20 +01:00
parent 684cbf62a5
commit 7062a13338
8 changed files with 22 additions and 26 deletions

4
build.gradle vendored
View file

@ -1,5 +1,4 @@
plugins { plugins {
id "checkstyle"
id "pmd" id "pmd"
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
@ -41,13 +40,10 @@ dependencies {
testImplementation testLibs.marc4j testImplementation testLibs.marc4j
} }
//apply from: rootProject.file('gradle/ide/idea.gradle')
apply from: rootProject.file('gradle/compile/java.gradle') apply from: rootProject.file('gradle/compile/java.gradle')
apply from: rootProject.file('gradle/test/junit5.gradle') apply from: rootProject.file('gradle/test/junit5.gradle')
apply from: rootProject.file('gradle/repositories/maven.gradle') apply from: rootProject.file('gradle/repositories/maven.gradle')
apply from: rootProject.file('gradle/quality/cyclonedx.gradle') apply from: rootProject.file('gradle/quality/cyclonedx.gradle')
//apply from: rootProject.file('gradle/quality/spotbugs.gradle')
apply from: rootProject.file('gradle/quality/checkstyle.gradle')
apply from: rootProject.file('gradle/quality/pmd.gradle') apply from: rootProject.file('gradle/quality/pmd.gradle')
apply from: rootProject.file('gradle/publish/maven.gradle') apply from: rootProject.file('gradle/publish/maven.gradle')
apply from: rootProject.file('gradle/publish/sonatype.gradle') apply from: rootProject.file('gradle/publish/sonatype.gradle')

2
gradle.properties vendored
View file

@ -1,5 +1,5 @@
group = org.xbib group = org.xbib
name = marc name = marc
version = 2.14.0 version = 2.14.1
org.gradle.warning.mode = ALL org.gradle.warning.mode = ALL

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

4
settings.gradle vendored
View file

@ -15,7 +15,7 @@ pluginManagement {
dependencyResolutionManagement { dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
libs { libs {
version('gradle', '8.4') version('gradle', '8.5')
} }
testLibs { testLibs {
version('junit', '5.10.0') version('junit', '5.10.0')
@ -25,11 +25,11 @@ dependencyResolutionManagement {
library('junit-jupiter-platform-launcher', 'org.junit.platform', 'junit-platform-launcher').version('1.10.0') library('junit-jupiter-platform-launcher', 'org.junit.platform', 'junit-platform-launcher').version('1.10.0')
library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2') library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2')
library('charactersets', 'org.xbib', 'bibliographic-character-sets').version('2.0.0') library('charactersets', 'org.xbib', 'bibliographic-character-sets').version('2.0.0')
library('json', 'org.xbib', 'content-json').version('5.0.1')
library('xalan', 'xalan', 'xalan').version('2.7.2') library('xalan', 'xalan', 'xalan').version('2.7.2')
library('xmlunit', 'org.xmlunit', 'xmlunit-matchers').version('2.8.4') library('xmlunit', 'org.xmlunit', 'xmlunit-matchers').version('2.8.4')
library('mockito', 'org.mockito', 'mockito-core').version('3.3.3') library('mockito', 'org.mockito', 'mockito-core').version('3.3.3')
library('marc4j', 'org.marc4j', 'marc4j').version('2.9.2') library('marc4j', 'org.marc4j', 'marc4j').version('2.9.2')
library('json', 'org.xbib', 'datastructures-json-tiny').version('5.0.6')
} }
} }
} }

View file

@ -22,8 +22,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.content.XContentBuilder; import org.xbib.datastructures.api.Builder;
import org.xbib.content.json.JsonXContent; import org.xbib.datastructures.json.tiny.JsonBuilder;
import org.xbib.marc.label.RecordLabel; import org.xbib.marc.label.RecordLabel;
import org.xbib.marc.transformer.value.MarcValueTransformers; import org.xbib.marc.transformer.value.MarcValueTransformers;
import org.xbib.marc.xml.MarcXchangeWriter; import org.xbib.marc.xml.MarcXchangeWriter;
@ -295,9 +295,9 @@ public class MarcRecordTest {
"100", Map.of("_", Map.of("a", "Hello World")))); "100", Map.of("_", Map.of("a", "Hello World"))));
MarcRecord marcRecord = MarcRecord.from(map); MarcRecord marcRecord = MarcRecord.from(map);
assertEquals("{001=123, 100={_={a=Hello World}}}", marcRecord.toString()); assertEquals("{001=123, 100={_={a=Hello World}}}", marcRecord.toString());
XContentBuilder builder = JsonXContent.contentBuilder(); Builder builder = JsonBuilder.builder();
builder.map(marcRecord); builder.buildMap(marcRecord);
assertEquals("{\"001\":\"123\",\"100\":{\"_\":{\"a\":\"Hello World\"}}}", builder.string()); assertEquals("{\"001\":\"123\",\"100\":{\"_\":{\"a\":\"Hello World\"}}}", builder.build());
} }
@Test @Test

View file

@ -16,8 +16,8 @@
package org.xbib.marc.filter; package org.xbib.marc.filter;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.content.XContentBuilder; import org.xbib.datastructures.api.Builder;
import org.xbib.content.json.JsonXContent; import org.xbib.datastructures.json.tiny.JsonBuilder;
import org.xbib.marc.Marc; import org.xbib.marc.Marc;
import org.xbib.marc.MarcField; import org.xbib.marc.MarcField;
import org.xbib.marc.MarcFieldAdapter; import org.xbib.marc.MarcFieldAdapter;
@ -93,15 +93,15 @@ public class MarcFieldFilterByRecordIdentifierTest {
.collect(Collectors.toList()); .collect(Collectors.toList());
// JSON output // JSON output
XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint() Builder builder = JsonBuilder.builder()
.startObject(); .beginMap();
for (Map.Entry<String, Map<String, List<Map<String, String>>>> entry : result.entrySet()) { for (Map.Entry<String, Map<String, List<Map<String, String>>>> entry : result.entrySet()) {
builder.field(entry.getKey(), entry.getValue()); builder.field(entry.getKey(), entry.getValue());
} }
builder.field("issns", issns); builder.field("issns", issns);
builder.endObject(); builder.endMap();
logger.log(Level.INFO, builder.string()); logger.log(Level.INFO, builder.build());
} }
private static boolean matchISSNField(MarcField field, MarcField.Subfield subfield) { private static boolean matchISSNField(MarcField field, MarcField.Subfield subfield) {

View file

@ -15,9 +15,9 @@
*/ */
package org.xbib.marc.filter; package org.xbib.marc.filter;
import static org.xbib.content.json.JsonXContent.contentBuilder;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xbib.content.XContentBuilder; import org.xbib.datastructures.api.Builder;
import org.xbib.datastructures.json.tiny.JsonBuilder;
import org.xbib.marc.Marc; import org.xbib.marc.Marc;
import org.xbib.marc.MarcField; import org.xbib.marc.MarcField;
import org.xbib.marc.MarcFieldAdapter; import org.xbib.marc.MarcFieldAdapter;
@ -77,15 +77,15 @@ public class MarcFieldFilterTest {
.collect(Collectors.toList()); .collect(Collectors.toList());
// JSON output // JSON output
XContentBuilder builder = contentBuilder().prettyPrint() Builder builder = JsonBuilder.builder()
.startObject(); .beginMap();
for (Map.Entry<String, List<Map<String, String>>> entry : result.entrySet()) { for (Map.Entry<String, List<Map<String, String>>> entry : result.entrySet()) {
builder.field(entry.getKey(), entry.getValue()); builder.field(entry.getKey(), entry.getValue());
} }
builder.array("issns", issns); builder.collection("issns", issns);
builder.endObject(); builder.endMap();
logger.log(Level.INFO, builder.string()); logger.log(Level.INFO, builder.build());
} }
private static boolean matchISSNField(MarcField field, MarcField.Subfield subfield) { private static boolean matchISSNField(MarcField field, MarcField.Subfield subfield) {