-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb42954
commit aa6ad77
Showing
20 changed files
with
425 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
group=org.babyfish.jimmer | ||
version=0.9.31 | ||
version=0.9.32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ect/jimmer-sql-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/ld/validation/A.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.babyfish.jimmer.sql.kt.model.ld.validation | ||
|
||
import org.babyfish.jimmer.sql.DatabaseValidationIgnore | ||
import org.babyfish.jimmer.sql.Entity | ||
import org.babyfish.jimmer.sql.Id | ||
import org.babyfish.jimmer.sql.LogicalDeleted | ||
|
||
@Entity | ||
@DatabaseValidationIgnore | ||
interface A { | ||
|
||
@Id | ||
val id: Long | ||
|
||
@LogicalDeleted("true") | ||
val deleted: Boolean | ||
} |
17 changes: 17 additions & 0 deletions
17
...ect/jimmer-sql-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/ld/validation/B.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.babyfish.jimmer.sql.kt.model.ld.validation | ||
|
||
import org.babyfish.jimmer.sql.DatabaseValidationIgnore | ||
import org.babyfish.jimmer.sql.Entity | ||
import org.babyfish.jimmer.sql.Id | ||
import org.babyfish.jimmer.sql.LogicalDeleted | ||
|
||
@Entity | ||
@DatabaseValidationIgnore | ||
interface B { | ||
|
||
@Id | ||
val id: Long | ||
|
||
@LogicalDeleted("false") | ||
val active: Boolean | ||
} |
17 changes: 17 additions & 0 deletions
17
...ect/jimmer-sql-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/ld/validation/C.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.babyfish.jimmer.sql.kt.model.ld.validation | ||
|
||
import org.babyfish.jimmer.sql.DatabaseValidationIgnore | ||
import org.babyfish.jimmer.sql.Entity | ||
import org.babyfish.jimmer.sql.Id | ||
import org.babyfish.jimmer.sql.LogicalDeleted | ||
|
||
@Entity | ||
@DatabaseValidationIgnore | ||
interface C { | ||
|
||
@Id | ||
val id: Long | ||
|
||
@LogicalDeleted("2") | ||
val state: Int | ||
} |
15 changes: 15 additions & 0 deletions
15
...ect/jimmer-sql-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/ld/validation/D.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.babyfish.jimmer.sql.kt.model.ld.validation | ||
|
||
import org.babyfish.jimmer.sql.* | ||
|
||
@Entity | ||
@DatabaseValidationIgnore | ||
interface D { | ||
|
||
@Id | ||
val id: Long | ||
|
||
@Default("1") | ||
@LogicalDeleted("2") | ||
val state: Int | ||
} |
15 changes: 15 additions & 0 deletions
15
...ect/jimmer-sql-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/ld/validation/E.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.babyfish.jimmer.sql.kt.model.ld.validation | ||
|
||
import org.babyfish.jimmer.sql.* | ||
|
||
@Entity | ||
@DatabaseValidationIgnore | ||
interface E { | ||
|
||
@Id | ||
val id: Long | ||
|
||
@Default("NEW") | ||
@LogicalDeleted("DELETED") | ||
val state: State | ||
} |
7 changes: 7 additions & 0 deletions
7
...jimmer-sql-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/ld/validation/State.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.babyfish.jimmer.sql.kt.model.ld.validation | ||
|
||
enum class State { | ||
NEW, | ||
PROCESSING, | ||
DELETED | ||
} |
88 changes: 88 additions & 0 deletions
88
...l-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/ld/validation/ValidationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package org.babyfish.jimmer.sql.kt.model.ld.validation | ||
|
||
import org.babyfish.jimmer.meta.ImmutableType | ||
import kotlin.test.Test | ||
import kotlin.test.expect | ||
|
||
class ValidationTest { | ||
|
||
@Test | ||
fun testA() { | ||
val type = ImmutableType.get(A::class.java) | ||
val prop = type.getProp("deleted") | ||
val info = type.logicalDeletedInfo ?: error("Impossible") | ||
expect(false) { | ||
prop.defaultValueRef.value | ||
} | ||
expect(false) { | ||
info.allocateInitializedValue() | ||
} | ||
expect(true) { | ||
info.generateValue() | ||
} | ||
} | ||
|
||
@Test | ||
fun testB() { | ||
val type = ImmutableType.get(B::class.java) | ||
val prop = type.getProp("active") | ||
val info = type.logicalDeletedInfo ?: error("Impossible") | ||
expect(true) { | ||
prop.defaultValueRef.value | ||
} | ||
expect(true) { | ||
info.allocateInitializedValue() | ||
} | ||
expect(false) { | ||
info.generateValue() | ||
} | ||
} | ||
|
||
@Test | ||
fun testC() { | ||
val type = ImmutableType.get(C::class.java) | ||
val prop = type.getProp("state") | ||
val info = type.logicalDeletedInfo ?: error("Impossible") | ||
expect(0) { | ||
prop.defaultValueRef.value | ||
} | ||
expect(0) { | ||
info.allocateInitializedValue() | ||
} | ||
expect(2) { | ||
info.generateValue() | ||
} | ||
} | ||
|
||
@Test | ||
fun testD() { | ||
val type = ImmutableType.get(D::class.java) | ||
val prop = type.getProp("state") | ||
val info = type.logicalDeletedInfo ?: error("Impossible") | ||
expect(1) { | ||
prop.defaultValueRef.value | ||
} | ||
expect(1) { | ||
info.allocateInitializedValue() | ||
} | ||
expect(2) { | ||
info.generateValue() | ||
} | ||
} | ||
|
||
@Test | ||
fun testE() { | ||
val type = ImmutableType.get(E::class.java) | ||
val prop = type.getProp("state") | ||
val info = type.logicalDeletedInfo ?: error("Impossible") | ||
expect(State.NEW) { | ||
prop.defaultValueRef.value | ||
} | ||
expect(State.NEW) { | ||
info.allocateInitializedValue() | ||
} | ||
expect(State.DELETED) { | ||
info.generateValue() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
project/jimmer-sql/src/test/java/org/babyfish/jimmer/sql/model/ld/validate/A.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.babyfish.jimmer.sql.model.ld.validate; | ||
|
||
import org.babyfish.jimmer.sql.DatabaseValidationIgnore; | ||
import org.babyfish.jimmer.sql.Entity; | ||
import org.babyfish.jimmer.sql.Id; | ||
import org.babyfish.jimmer.sql.LogicalDeleted; | ||
|
||
@DatabaseValidationIgnore | ||
@Entity | ||
public interface A { | ||
|
||
@Id | ||
long id(); | ||
|
||
@LogicalDeleted("true") | ||
boolean deleted(); | ||
} |
17 changes: 17 additions & 0 deletions
17
project/jimmer-sql/src/test/java/org/babyfish/jimmer/sql/model/ld/validate/B.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.babyfish.jimmer.sql.model.ld.validate; | ||
|
||
import org.babyfish.jimmer.sql.DatabaseValidationIgnore; | ||
import org.babyfish.jimmer.sql.Entity; | ||
import org.babyfish.jimmer.sql.Id; | ||
import org.babyfish.jimmer.sql.LogicalDeleted; | ||
|
||
@DatabaseValidationIgnore | ||
@Entity | ||
public interface B { | ||
|
||
@Id | ||
long id(); | ||
|
||
@LogicalDeleted("false") | ||
boolean active(); | ||
} |
17 changes: 17 additions & 0 deletions
17
project/jimmer-sql/src/test/java/org/babyfish/jimmer/sql/model/ld/validate/C.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.babyfish.jimmer.sql.model.ld.validate; | ||
|
||
import org.babyfish.jimmer.sql.DatabaseValidationIgnore; | ||
import org.babyfish.jimmer.sql.Entity; | ||
import org.babyfish.jimmer.sql.Id; | ||
import org.babyfish.jimmer.sql.LogicalDeleted; | ||
|
||
@DatabaseValidationIgnore | ||
@Entity | ||
public interface C { | ||
|
||
@Id | ||
long id(); | ||
|
||
@LogicalDeleted("2") | ||
int state(); | ||
} |
15 changes: 15 additions & 0 deletions
15
project/jimmer-sql/src/test/java/org/babyfish/jimmer/sql/model/ld/validate/D.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.babyfish.jimmer.sql.model.ld.validate; | ||
|
||
import org.babyfish.jimmer.sql.*; | ||
|
||
@DatabaseValidationIgnore | ||
@Entity | ||
public interface D { | ||
|
||
@Id | ||
long id(); | ||
|
||
@Default("1") | ||
@LogicalDeleted("2") | ||
int state(); | ||
} |
15 changes: 15 additions & 0 deletions
15
project/jimmer-sql/src/test/java/org/babyfish/jimmer/sql/model/ld/validate/E.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.babyfish.jimmer.sql.model.ld.validate; | ||
|
||
import org.babyfish.jimmer.sql.*; | ||
|
||
@DatabaseValidationIgnore | ||
@Entity | ||
public interface E { | ||
|
||
@Id | ||
long id(); | ||
|
||
@Default("NEW") | ||
@LogicalDeleted("DELETED") | ||
State state(); | ||
} |
8 changes: 8 additions & 0 deletions
8
project/jimmer-sql/src/test/java/org/babyfish/jimmer/sql/model/ld/validate/State.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.babyfish.jimmer.sql.model.ld.validate; | ||
|
||
public enum State { | ||
|
||
NEW, | ||
PROCESSING, | ||
DELETED | ||
} |
Oops, something went wrong.