Upgrade to Spring Boot 3

This commit is contained in:
Erik Greijus
2023-08-29 12:52:50 +02:00
parent 6bddecd3f2
commit 497eebe55c
38 changed files with 346 additions and 404 deletions

View File

@@ -11,7 +11,7 @@ project('spring-statemachine-data-jpa') {
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
testImplementation(testFixtures(project(":spring-statemachine-core")))
testImplementation 'io.projectreactor:reactor-test'
optional 'org.eclipse.persistence:javax.persistence'
optional 'jakarta.persistence:jakarta.persistence-api'
testImplementation 'org.hsqldb:hsqldb'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.springframework.boot:spring-boot-starter-data-jpa'
@@ -27,7 +27,7 @@ project('spring-statemachine-data-redis') {
api project(':spring-statemachine-data-common')
api 'org.springframework.data:spring-data-redis'
testImplementation project(':spring-statemachine-test')
optional 'org.eclipse.persistence:javax.persistence'
optional 'jakarta.persistence:jakarta.persistence-api'
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
testImplementation(testFixtures(project(":spring-statemachine-core")))
testImplementation 'io.projectreactor:reactor-test'
@@ -47,7 +47,7 @@ project('spring-statemachine-data-mongodb') {
api project(':spring-statemachine-data-common')
api 'org.springframework.data:spring-data-mongodb'
testImplementation project(':spring-statemachine-test')
optional 'org.eclipse.persistence:javax.persistence'
optional 'jakarta.persistence:jakarta.persistence-api'
testImplementation(testFixtures(project(":spring-statemachine-data-common")))
testImplementation(testFixtures(project(":spring-statemachine-core")))
testImplementation 'io.projectreactor:reactor-test'

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,17 +15,15 @@
*/
package org.springframework.statemachine.data.jpa;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import org.springframework.statemachine.data.RepositoryAction;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.springframework.statemachine.data.RepositoryAction;
/**
* JPA entity for actions.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,17 +15,15 @@
*/
package org.springframework.statemachine.data.jpa;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import org.springframework.statemachine.data.RepositoryGuard;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.springframework.statemachine.data.RepositoryGuard;
/**
* JPA entity for actions.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,30 +15,28 @@
*/
package org.springframework.statemachine.data.jpa;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.CollectionTable;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.util.Set;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.springframework.statemachine.data.RepositoryAction;
import org.springframework.statemachine.data.RepositoryState;
import org.springframework.statemachine.state.PseudoStateKind;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
* JPA entity for states.
*
@@ -76,7 +74,7 @@ public class JpaRepositoryState extends RepositoryState {
@JoinColumn(foreignKey = @ForeignKey(name = "fk_state_initial_action"))
private JpaRepositoryAction initialAction;
@OneToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(foreignKey = @ForeignKey(name = "fk_state_parent_state"))
private JpaRepositoryState parentState;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2020 the original author or authors.
* Copyright 2017-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,16 +15,14 @@
*/
package org.springframework.statemachine.data.jpa;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import org.springframework.statemachine.data.RepositoryStateMachine;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import org.springframework.statemachine.data.RepositoryStateMachine;
/**
* A {@link RepositoryStateMachine} interface for JPA used for states machines.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,26 +15,23 @@
*/
package org.springframework.statemachine.data.jpa;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.OneToOne;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ForeignKey;
import javax.persistence.ManyToMany;
import javax.persistence.JoinTable;
import org.springframework.statemachine.data.RepositoryTransition;
import org.springframework.statemachine.transition.TransitionKind;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.util.Set;
import org.springframework.statemachine.data.RepositoryTransition;
import org.springframework.statemachine.transition.TransitionKind;
/**
* JPA entity for transitions.
@@ -55,11 +52,11 @@ public class JpaRepositoryTransition extends RepositoryTransition {
@Column(name = "machine_id")
private String machineId;
@OneToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(foreignKey = @ForeignKey(name = "fk_transition_source"))
private JpaRepositoryState source;
@OneToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(foreignKey = @ForeignKey(name = "fk_transition_target"))
private JpaRepositoryState target;
@@ -73,7 +70,7 @@ public class JpaRepositoryTransition extends RepositoryTransition {
@JoinTable(foreignKey = @ForeignKey(name = "fk_transition_actions_t"), inverseForeignKey = @ForeignKey(name = "fk_transition_actions_a"))
private Set<JpaRepositoryAction> actions;
@OneToOne(fetch = FetchType.EAGER)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(foreignKey = @ForeignKey(name = "fk_transition_guard"))
private JpaRepositoryGuard guard;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,24 +18,24 @@ package org.springframework.statemachine.data.mongodb;
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
import java.net.Socket;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.springframework.util.SocketUtils;
public class EnabledOnMongoDbCondition implements ExecutionCondition {
static final ConditionEvaluationResult ENABLED_ON_MONGO = enabled("Mongo DB found");
static final ConditionEvaluationResult ENABLED_ON_MONGO = enabled("Mongo DB found");
static final ConditionEvaluationResult DISABLED_ON_MONGO = disabled("Mongo DB not found");
static final ConditionEvaluationResult DISABLED_ON_MONGO = disabled("Mongo DB not found");
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
try {
SocketUtils.findAvailableTcpPort(27017, 27017);
return DISABLED_ON_MONGO;
} catch (Exception e) {
}
return ENABLED_ON_MONGO;
}
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
try {
new Socket("localhost", 27017);
return ENABLED_ON_MONGO;
} catch (Exception e) {
return DISABLED_ON_MONGO;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,17 +15,11 @@
*/
package org.springframework.statemachine.data.redis;
import org.springframework.data.annotation.Id;
//import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
//import javax.persistence.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.statemachine.data.RepositoryAction;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.statemachine.data.RepositoryAction;
/**
* Redis entity for actions.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,17 +15,11 @@
*/
package org.springframework.statemachine.data.redis;
import org.springframework.data.annotation.Id;
//import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
//import javax.persistence.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.statemachine.data.RepositoryGuard;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.statemachine.data.RepositoryGuard;
/**
* Redis entity for actions.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,16 +15,9 @@
*/
package org.springframework.statemachine.data.redis;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import java.util.Set;
//import javax.persistence.ElementCollection;
//import javax.persistence.FetchType;
//import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
//import javax.persistence.Id;
//import javax.persistence.OneToMany;
//import javax.persistence.OneToOne;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Reference;
import org.springframework.data.redis.core.RedisHash;
@@ -33,9 +26,6 @@ import org.springframework.statemachine.data.RepositoryAction;
import org.springframework.statemachine.data.RepositoryState;
import org.springframework.statemachine.state.PseudoStateKind;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
* Redis entity for states.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,26 +15,16 @@
*/
package org.springframework.statemachine.data.redis;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Reference;
//import javax.persistence.FetchType;
//import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
//import javax.persistence.Id;
//import javax.persistence.OneToMany;
//import javax.persistence.OneToOne;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;
import org.springframework.statemachine.data.RepositoryTransition;
import org.springframework.statemachine.transition.TransitionKind;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
* Redis entity for transitions.
*