Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class WebConfig {
* @return RestTemplate
*/
@Bean
@SuppressWarnings("removal")
RestTemplate restTemplate(IScopes scopes) {
RestTemplate restTemplate = new RestTemplate();
SentrySpanClientHttpRequestInterceptor sentryRestTemplateInterceptor =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

@Service
public class PersonService {
@SuppressWarnings("removal")
private final RestTemplate restTemplate;

@SuppressWarnings("removal")
public PersonService(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@SpringBootApplication
@EnableCaching
@EnableScheduling
@SuppressWarnings("removal")
public class SentryDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SentryDemoApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import reactor.core.scheduler.Schedulers;

@RestController
@SuppressWarnings("removal")
public class TodoController {
private final RestTemplate restTemplate;
private final WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

@SpringBootApplication
@EnableScheduling
@SuppressWarnings("removal")
public class SentryDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SentryDemoApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import reactor.core.scheduler.Schedulers;

@RestController
@SuppressWarnings("removal")
public class TodoController {
private final RestTemplate restTemplate;
private final WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
@SpringBootApplication
@EnableCaching
@EnableScheduling
@SuppressWarnings("removal")
public class SentryDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SentryDemoApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import reactor.core.scheduler.Schedulers;

@RestController
@SuppressWarnings("removal")
public class TodoController {
private final RestTemplate restTemplate;
private final WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
@SpringBootApplication
@EnableCaching
@EnableScheduling
@SuppressWarnings("removal")
public class SentryDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SentryDemoApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import reactor.core.scheduler.Schedulers;

@RestController
@SuppressWarnings("removal")
public class TodoController {
private final RestTemplate restTemplate;
private final WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@SpringBootApplication
@EnableCaching
@EnableScheduling
@SuppressWarnings("removal")
public class SentryDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SentryDemoApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import tools.jackson.databind.ObjectMapper;

@RestController
@SuppressWarnings("removal")
public class TodoController {
private final RestTemplate restTemplate;
private final WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package io.sentry.spring7.graphql

import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters
import graphql.language.Document
import graphql.language.Field
import graphql.language.OperationDefinition
import graphql.language.SelectionSet
import graphql.schema.DataFetchingEnvironment
import io.sentry.IScopes
import io.sentry.graphql.ExceptionReporter
Expand All @@ -20,22 +22,26 @@ import org.springframework.graphql.execution.SubscriptionPublisherException
import reactor.core.publisher.Flux

class SentrySpringSubscriptionHandlerTest {
private val document =
Document.newDocument()
.definition(
OperationDefinition.newOperationDefinition()
.operation(OperationDefinition.Operation.QUERY)
.name("testQuery")
.selectionSet(
SelectionSet.newSelectionSet().selection(Field.newField("test").build()).build()
)
.build()
)
.build()

@Test
fun `reports exception`() {
val exception = IllegalStateException("some exception")
val scopes = mock<IScopes>()
val exceptionReporter = mock<ExceptionReporter>()
val parameters = mock<InstrumentationFieldFetchParameters>()
val dataFetchingEnvironment = mock<DataFetchingEnvironment>()
val document =
Document.newDocument()
.definition(
OperationDefinition.newOperationDefinition()
.operation(OperationDefinition.Operation.QUERY)
.name("testQuery")
.build()
)
.build()
whenever(dataFetchingEnvironment.document).thenReturn(document)
whenever(parameters.environment).thenReturn(dataFetchingEnvironment)
val resultObject =
Expand All @@ -49,7 +55,7 @@ class SentrySpringSubscriptionHandlerTest {
check {
assertEquals(true, it.isSubscription)
assertSame(scopes, it.scopes)
assertEquals("query testQuery \n", it.query)
assertEquals("query testQuery {\n test\n}\n", it.query)
},
anyOrNull(),
)
Expand All @@ -63,15 +69,6 @@ class SentrySpringSubscriptionHandlerTest {
val exceptionReporter = mock<ExceptionReporter>()
val parameters = mock<InstrumentationFieldFetchParameters>()
val dataFetchingEnvironment = mock<DataFetchingEnvironment>()
val document =
Document.newDocument()
.definition(
OperationDefinition.newOperationDefinition()
.operation(OperationDefinition.Operation.QUERY)
.name("testQuery")
.build()
)
.build()
whenever(dataFetchingEnvironment.document).thenReturn(document)
whenever(parameters.environment).thenReturn(dataFetchingEnvironment)
val resultObject =
Expand All @@ -90,7 +87,7 @@ class SentrySpringSubscriptionHandlerTest {
check {
assertEquals(true, it.isSubscription)
assertSame(scopes, it.scopes)
assertEquals("query testQuery \n", it.query)
assertEquals("query testQuery {\n test\n}\n", it.query)
},
anyOrNull(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ static class SentrySpanPointcutAutoConfiguration {}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({RestTemplate.class, RestTemplateAutoConfiguration.class})
@Open
@SuppressWarnings("removal")
static class SentryPerformanceRestTemplateConfigurationWrapper {
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore(RestTemplateAutoConfiguration.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.web.client.RestTemplate;

@Open
@SuppressWarnings("removal")
class SentrySpanRestTemplateCustomizer implements RestTemplateCustomizer {
private final @NotNull SentrySpanClientHttpRequestInterceptor interceptor;

Expand Down
Loading