Task: Add Netflix DGS framework and DGS codegen for GraphQL and still issued with subscriptions that not work on server and add some configurations and add webflux included web starter and removed all graphql kickstart and add frontend client with apollo client and react in typescript for graphql demo
This commit is contained in:
@@ -1,13 +1,55 @@
|
||||
package com.cubetiqs.graphql.demo
|
||||
|
||||
import com.cubetiqs.graphql.demo.resolver.subscription.HelloSubscriptionResolver
|
||||
import com.netflix.graphql.dgs.DgsQueryExecutor
|
||||
import com.netflix.graphql.dgs.autoconfig.DgsAutoConfiguration
|
||||
import graphql.ExecutionResult
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.reactivestreams.Publisher
|
||||
import org.reactivestreams.Subscriber
|
||||
import org.reactivestreams.Subscription
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.test.context.SpringBootTest
|
||||
|
||||
@SpringBootTest
|
||||
@SpringBootTest(
|
||||
classes = [
|
||||
DgsAutoConfiguration::class,
|
||||
HelloSubscriptionResolver::class,
|
||||
]
|
||||
)
|
||||
class GraphqlDemoApplicationTests {
|
||||
@Autowired
|
||||
lateinit var dgsQueryExecutor: DgsQueryExecutor
|
||||
|
||||
@Test
|
||||
fun contextLoads() {
|
||||
}
|
||||
@Test
|
||||
fun helloSubscription() {
|
||||
dgsQueryExecutor.execute(
|
||||
"""
|
||||
subscription {
|
||||
hello
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
.getData<Publisher<ExecutionResult>>()
|
||||
.subscribe(object : Subscriber<ExecutionResult> {
|
||||
override fun onSubscribe(s: Subscription) {
|
||||
s.request(2)
|
||||
}
|
||||
|
||||
override fun onNext(t: ExecutionResult) {
|
||||
println(t.getData<Any?>())
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
println("Hello World")
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user