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

test: javax/jakarta.persistence.Transient remains in Introspected #10110

Merged
merged 1 commit into from
Nov 14, 2023
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
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jakarta-inject-tck = "2.0.1"
javax-annotation-api = "1.3.2"
javax-inject = "1"
javax-persistence = "2.2"
jakarta-persistence = "3.1.0"
jetbrains-annotations = "23.0.0"
jetty = "9.4.48.v20220622"
jmh = "1.36"
Expand Down Expand Up @@ -186,6 +187,7 @@ jakarta-el = { module = "jakarta.el:jakarta.el-api", version.ref = "jakarta-el"
jakarta-el-impl = { module = "org.glassfish:jakarta.el", version.ref = "jakarta-el-impl" }
javax-inject = { module = "javax.inject:javax.inject", version.ref = "javax-inject" }
javax-persistence = { module = "javax.persistence:javax.persistence-api", version.ref = "javax-persistence" }
jakarta-persistence = { module = "jakarta.persistence:jakarta.persistence-api", version.ref = "jakarta-persistence" }

jcache = { module = "javax.cache:cache-api", version.ref = "jcache" }

Expand Down
2 changes: 2 additions & 0 deletions test-suite-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ dependencies {

testImplementation libs.managed.reactor
testImplementation(libs.awaitility)
testImplementation(libs.javax.persistence)
testImplementation(libs.jakarta.persistence)
}

//compileTestGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.beans.BeanIntrospection
import org.junit.jupiter.api.Test
import spock.lang.Specification

class JakartaTransientSpec extends Specification {
@Test
void "test introspection with jakarta transient"() {
when:
BeanIntrospection<ObjectWithJakartaTransient> introspection = BeanIntrospection.getIntrospection(ObjectWithJakartaTransient)

then:
introspection.getProperty("tmp").isPresent()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.beans.BeanIntrospection
import org.junit.jupiter.api.Test
import spock.lang.Specification

class JavaxTransientSpec extends Specification {
@Test
void "test introspection with javax transient"() {
when:
BeanIntrospection<ObjectWithJavaxTransient> introspection = BeanIntrospection.getIntrospection(ObjectWithJavaxTransient)

then:
introspection.getProperty("tmp").isPresent()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.annotation.Introspected

import javax.persistence.Transient

@Introspected
class ObjectWithJakartaTransient {

@Transient
private String tmp;

String getTmp() {
return tmp
}

void setTmp(String tmp) {
this.tmp = tmp
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.annotation.Introspected

import javax.persistence.Transient

@Introspected
class ObjectWithJavaxTransient {

@Transient
private String tmp;

String getTmp() {
return tmp
}

void setTmp(String tmp) {
this.tmp = tmp
}
}
3 changes: 3 additions & 0 deletions test-suite-kotlin-ksp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ dependencies {
testImplementation libs.bcpkix

testImplementation libs.managed.reactor

testImplementation(libs.javax.persistence)
testImplementation(libs.jakarta.persistence)
}

configurations.testRuntimeClasspath {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.beans.BeanIntrospection
import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions

class JakartaTransientTest {
@Test
fun testIntrospectionWithJakartaTransient() {
val introspection: BeanIntrospection<ObjectWithJakartaTransient> = BeanIntrospection.getIntrospection(ObjectWithJakartaTransient::class.java);
Assertions.assertTrue(introspection.getProperty("tmp").isPresent())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.beans.BeanIntrospection
import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions;

class JavaxTransientTest {
@Test
fun testIntrospectionWithJavaxTransient() {
val introspection: BeanIntrospection<ObjectWithJavaxTransient> = BeanIntrospection.getIntrospection(ObjectWithJavaxTransient::class.java);
Assertions.assertTrue(introspection.getProperty("tmp").isPresent())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.annotation.Introspected

import jakarta.persistence.Transient

@Introspected
data class ObjectWithJakartaTransient(@field:Transient var tmp: String) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.annotation.Introspected

import javax.persistence.Transient

@Introspected
data class ObjectWithJavaxTransient(@field:Transient var tmp: String) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.micronaut.docs.ioc.introspection

// tag::class[]
import io.micronaut.core.annotation.AccessorsStyle
import io.micronaut.core.annotation.Introspected

@Introspected
@AccessorsStyle(readPrefixes = [""], writePrefixes = [""]) // <1>
class Person(private var name: String, private var age: Int) {
fun name(): String { // <2>
return name
}

fun name(name: String) { // <2>
this.name = name
}

fun age(): Int { // <2>
return age
}

fun age(age: Int) { // <2>
this.age = age
}
}
// end::class[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.beans.BeanIntrospection
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test

class PersonSpec {

@Test
fun testPersonIntrospection() {
// tag::usage[]
val introspection = BeanIntrospection.getIntrospection(Person::class.java)
val person = introspection.instantiate("John", 42)

Assertions.assertEquals("John", person.name())
Assertions.assertEquals(42, person.age())
// end::usage[]
}
}
3 changes: 3 additions & 0 deletions test-suite-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ dependencies {
testImplementation libs.bcpkix

testImplementation libs.managed.reactor

testImplementation(libs.javax.persistence)
testImplementation(libs.jakarta.persistence)
}

configurations.testRuntimeClasspath {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.beans.BeanIntrospection
import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions

class JakartaTransientTest {
@Test
fun testIntrospectionWithJakartaTransient() {
val introspection: BeanIntrospection<ObjectWithJakartaTransient> = BeanIntrospection.getIntrospection(ObjectWithJakartaTransient::class.java);
Assertions.assertTrue(introspection.getProperty("tmp").isPresent())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.beans.BeanIntrospection
import org.junit.jupiter.api.Test

import org.junit.jupiter.api.Assertions;

class JavaxTransientTest {
@Test
fun testIntrospectionWithJavaxTransient() {
val introspection: BeanIntrospection<ObjectWithJavaxTransient> = BeanIntrospection.getIntrospection(ObjectWithJavaxTransient::class.java);
Assertions.assertTrue(introspection.getProperty("tmp").isPresent())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.annotation.Introspected

import jakarta.persistence.Transient

@Introspected
data class ObjectWithJakartaTransient(@field:Transient var tmp: String) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.micronaut.docs.ioc.introspection

import io.micronaut.core.annotation.Introspected

import javax.persistence.Transient

@Introspected
data class ObjectWithJavaxTransient(@field:Transient var tmp: String) {
}
3 changes: 3 additions & 0 deletions test-suite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ dependencies {
testFixturesApi libs.spock
testFixturesApi libs.managed.groovy
testFixturesApi libs.jetbrains.annotations

testImplementation(libs.javax.persistence)
testImplementation(libs.jakarta.persistence)
}

//tasks.withType(Test).configureEach {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.micronaut.docs.ioc.introspection;

import io.micronaut.core.beans.BeanIntrospection;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;

class JakartaTransientTest {
@Test
void testIntrospectionWithJakartaTransient() {
BeanIntrospection<ObjectWithJakartaTransient> introspection = BeanIntrospection.getIntrospection(ObjectWithJakartaTransient.class);
assertTrue(introspection.getProperty("tmp").isPresent());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.micronaut.docs.ioc.introspection;

import io.micronaut.core.beans.BeanIntrospection;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;

class JavaxTransientTest {
@Test
void testIntrospectionWithJavaxTransient() {
BeanIntrospection<ObjectWithJavaxTransient> introspection = BeanIntrospection.getIntrospection(ObjectWithJavaxTransient.class);
assertTrue(introspection.getProperty("tmp").isPresent());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.micronaut.docs.ioc.introspection;

import io.micronaut.core.annotation.Introspected;

import javax.persistence.Transient;

@Introspected
public class ObjectWithJakartaTransient {

@Transient
private String tmp;

String getTmp() {
return tmp;
}

void setTmp(String tmp) {
this.tmp = tmp;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.micronaut.docs.ioc.introspection;

import io.micronaut.core.annotation.Introspected;

import javax.persistence.Transient;

@Introspected
class ObjectWithJavaxTransient {

@Transient
private String tmp;

String getTmp() {
return tmp;
}

void setTmp(String tmp) {
this.tmp = tmp;
}
}
Loading