Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javax to jakarta fixes #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Crnk is an implementation of the [JSON API](https://jsonapi.org/) specification
facilitate building RESTful applications. It provides many conventions and building blocks that application can benefit from.
This includes features such as sorting, filtering, pagination, requesting complex object graphs, sparse
field sets, attaching links to data or atomically execute multiple operations. Further integration
with frameworks and libraries such as Spring, CDI, JPA, Bean Validation, Dropwizard, Servlet API, Zipkin and
with frameworks and libraries such as Spring, CDI, JPA, Hibernate, Bean Validation, Dropwizard, Servlet API, Zipkin
and more ensure that JSON API plays well together with the Java ecosystem. Have a look at
[www.crnk.io](http://www.crnk.io) and the [documentation](http://www.crnk.io/releases/stable/documentation/) for more detailed
information.
Expand All @@ -28,7 +28,7 @@ Note that due to reliability issues of MavenCentral we only rarely publish there

## Requirements

Crnk requires Java 1.8 or later and an SLF4J setup for logging.
Crnk requires Java 17, Spring Boot 3, Hibernate 6.6.0 or later and an SLF4J setup for logging.

## Example

Expand Down
166 changes: 87 additions & 79 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ buildscript {
}
}

plugins {
id 'eclipse'
id 'java'
id 'java-library'
id 'maven-publish'
}


import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar

Expand Down Expand Up @@ -83,7 +91,6 @@ gradle.beforeProject { Project project ->
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.24.2'
api group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '2.1.1'
api group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '4.0.1'
api group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '4.0.3'
}

test {
Expand All @@ -95,34 +102,35 @@ gradle.beforeProject { Project project ->
}
}

configurations.all {
configurations.configureEach {
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j"
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'commons-logging', module: 'commons-logging'
}

apply plugin: 'io.spring.dependency-management'
dependencyManagement {
imports {
mavenBom 'io.projectreactor:reactor-bom:Bismuth-RELEASE'
mavenBom 'org.glassfish.jersey:jersey-bom:3.1.3'
mavenBom 'org.glassfish.jersey:jersey-bom:3.0.14'
}
dependencies {
dependency 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2'
dependency 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.2'
dependency 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider:2.15.3'
dependency 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-xml-provider:2.15.3'
dependency 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-base:2.15.3'
dependency 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2'
dependency 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.4'
dependency 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.4'
dependency 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider:2.15.4'
dependency 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-xml-provider:2.15.4'
dependency 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-base:2.15.4'
dependency 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.4'

dependency 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'
dependency 'com.sun.xml.bind:jaxb-impl:4.0.3'

dependency 'org.reflections:reflections:0.10.2'
}
}
}
}
}
// }
//
// // TODO gradle publishing to maven central?
// if (!docs && !examples && !testProject && !legacyBraveProject) {
Expand Down Expand Up @@ -154,87 +162,87 @@ gradle.beforeProject { Project project ->
// }
// }
//
// apply plugin: 'maven-publish'
//
// if (!docs && !examples) {
//
// task sourcesJar(type: Jar) {
// from sourceSets.main.allSource
// classifier = 'sources'
// }
//
// task javadocJar(type: Jar, dependsOn: 'javadoc') {
// from javadoc.destinationDir
// classifier = 'javadoc'
// }
//
//
// plugins.withId("com.vanniktech.maven.publish.base") {
// group = GROUP_ID
//
// mavenPublishing {
apply plugin: 'maven-publish'

if (!docs && !examples) {

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}

task javadocJar(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
archiveClassifier = 'javadoc'
}


plugins.withId("com.vanniktech.maven.publish.base") {
group = GROUP_ID

mavenPublishing {
// publishToMavenCentral("DEFAULT")
//
// // Will only apply to non snapshot builds.
// // Uses credentials as described above, supports both regular and in memory signing.
// signAllPublications()
//
// pom {
// name = "Crnk"
// description = "A description of what my library does."
// inceptionYear = "2020"
// url = "https ://github.com/crnk-project/crnk-framework/"
// licenses {
// license {
// name = "The Apache License, Version 2.0"
// url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
// distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
// }
// }
// developers {
// developer {
// id = "crnk"
// name = "crnk"
// url = "https://github.com/crnk-project/"
// }
// }
// scm {
// url = "https://github.com/crnk-project/crnk-framework"
// connection = "scm:git:git://github.com/crnk-project/crnk-framework.git"
// developerConnection = "scm:git:ssh://[email protected]/crnk-project/crnk-framework.git"
// }
// }
// }
// }
//
// apply plugin: "com.vanniktech.maven.publish.base"
//
// mavenPublishing {
// // available options:
// // - JavaLibrary
// // - GradlePlugin
// // - AndroidLibrary
// // - KotlinJvm
// // - KotlinJs
// // - KotlinMultiplatform
// // the first parameter configures the javadoc jar, available options:
// // - None
// // - Empty
// // - Javadoc
// // - Dokka("dokkaHtml") - the parameter is the name of the Dokka task
// // second one is for whether to publish sources, optional, defaults to true (not supported for KotlinMultiplatform(
// // AndroidLibrary has a third parameter for which variant to publish, defaults to "release"
// configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
// }
pom {
name = "Crnk"
description = "A description of what my library does."
inceptionYear = "2020"
url = "https ://github.com/crnk-project/crnk-framework/"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "crnk"
name = "crnk"
url = "https://github.com/crnk-project/"
}
}
scm {
url = "https://github.com/crnk-project/crnk-framework"
connection = "scm:git:git://github.com/crnk-project/crnk-framework.git"
developerConnection = "scm:git:ssh://[email protected]/crnk-project/crnk-framework.git"
}
}
}
}

apply plugin: "com.vanniktech.maven.publish.base"

mavenPublishing {
// available options:
// - JavaLibrary
// - GradlePlugin
// - AndroidLibrary
// - KotlinJvm
// - KotlinJs
// - KotlinMultiplatform
// the first parameter configures the javadoc jar, available options:
// - None
// - Empty
// - Javadoc
// - Dokka("dokkaHtml") - the parameter is the name of the Dokka task
// second one is for whether to publish sources, optional, defaults to true (not supported for KotlinMultiplatform(
// AndroidLibrary has a third parameter for which variant to publish, defaults to "release"
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
}
//
//
// def releaseBuild = project.hasProperty('stable')
//
//
// }
}
//
// }
// }
}
//
// // coveralls setup
// apply plugin: "jacoco"
Expand Down
14 changes: 7 additions & 7 deletions crnk-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ plugins {
dependencies {
api project(':crnk-core')

api 'org.apache.httpcomponents:httpclient:4.5.2'
api 'org.glassfish.jersey.ext:jersey-proxy-client:3.1.3'
api 'org.glassfish.jersey.core:jersey-common:3.1.3'
api 'org.glassfish.jersey.core:jersey-client:3.1.3'
api 'org.glassfish.jersey.core:jersey-server:3.1.3'
api 'org.glassfish.jersey.media:jersey-media-json-jackson:3.1.3'
api 'org.apache.httpcomponents:httpclient:4.5.13'
api 'org.glassfish.jersey.ext:jersey-proxy-client:3.0.14'
api 'org.glassfish.jersey.core:jersey-common:3.0.14'
api 'org.glassfish.jersey.core:jersey-client:3.0.14'
api 'org.glassfish.jersey.core:jersey-server:3.0.14'
api 'org.glassfish.jersey.media:jersey-media-json-jackson:3.0.14'
api 'com.squareup.okhttp3:okhttp:3.4.1'
api 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider:2.15.3'
api 'com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider:2.15.4'

testImplementation project(':crnk-setup:crnk-setup-rs')
testImplementation project(':crnk-test')
Expand Down
11 changes: 6 additions & 5 deletions crnk-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ plugins {
dependencies {
api 'net.jodah:typetools:0.6.3'
api 'org.slf4j:slf4j-api:2.0.9'
api 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2'
api 'org.slf4j:jcl-over-slf4j:2.0.9'
api 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.4'
api 'jakarta.validation:jakarta.validation-api:3.0.2'
api 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'

Expand All @@ -20,12 +21,12 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-engine:$JUNIT_VERSION"
testImplementation "org.junit.vintage:junit-vintage-engine:$JUNIT_VERSION"

testImplementation 'ch.qos.logback:logback-classic:1.4.11'
testImplementation 'ch.qos.logback:logback-classic:1.4.14'
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'org.assertj:assertj-core:2.2.0'
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
testImplementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2'
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.4'
testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.4'
testImplementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.4'

testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.15.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public int hashCode() {
result = prime * result + (readable ? 1231 : 1237);
result = prime * result + (patchable ? 1231 : 1237);
result = prime * result + (postable ? 1231 : 1237);
result = prime * result + (deletable ? 1231 : 1237);
result = prime * result + (sortable ? 1231 : 1237);
result = prime * result + (filterable ? 1231 : 1237);
return result;
Expand All @@ -113,7 +114,8 @@ public boolean equals(Object obj) {
return false;
}
ResourceFieldAccess other = (ResourceFieldAccess) obj;
return readable == other.readable && patchable == other.patchable && postable == other.postable && sortable == other.sortable
return readable == other.readable && patchable == other.patchable && postable == other.postable && deletable == other.deletable
&& sortable == other.sortable
&& filterable == other.filterable;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public class ResourceFieldAccessTest {

@Test
public void testEqualsContract() {
EqualsVerifier.forClass(ResourceFieldAccess.class).usingGetClass().verify();
EqualsVerifier.forClass(ResourceFieldAccess.class)
.usingGetClass()
.verify();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.crnk.core.engine.document;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import io.crnk.core.utils.Nullable;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
Expand All @@ -18,7 +21,13 @@ public class DocumentTest {

@Test
public void testDocumentEqualsContract() {
EqualsVerifier.forClass(Document.class).usingGetClass().suppress(Warning.NONFINAL_FIELDS).verify();
EqualsVerifier.forClass(Document.class)
.usingGetClass()
.suppress(Warning.NONFINAL_FIELDS)
// https://github.com/jqno/equalsverifier/issues/486
.withPrefabValues(JsonNode.class, NullNode.instance, new TextNode("foo"))
.withIgnoredFields("jsonapi") // ignore unused fields in equals and hashcode
.verify();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package io.crnk.core.engine.document;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.TextNode;
import io.crnk.core.engine.internal.jackson.JacksonModule;
import io.crnk.core.utils.Nullable;
import nl.jqno.equalsverifier.EqualsVerifier;
Expand All @@ -15,7 +18,12 @@ public class RelationshipTest {

@Test
public void testResourceEqualsContract() {
EqualsVerifier.forClass(Relationship.class).usingGetClass().suppress(Warning.NONFINAL_FIELDS).verify();
EqualsVerifier.forClass(Relationship.class)
.usingGetClass()
.suppress(Warning.NONFINAL_FIELDS)
// https://github.com/jqno/equalsverifier/issues/486
.withPrefabValues(JsonNode.class, NullNode.instance, new TextNode("foo"))
.verify();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public class ResourceIdentifierTest {

@Test
public void testResourceIdentifierEqualsContract() {
EqualsVerifier.forClass(ResourceIdentifier.class).usingGetClass().suppress(Warning.NONFINAL_FIELDS).verify();
EqualsVerifier.forClass(ResourceIdentifier.class)
.usingGetClass()
.suppress(Warning.NONFINAL_FIELDS)
.verify();
}
}
Loading