-
Notifications
You must be signed in to change notification settings - Fork 93
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
Batch exception fix when unwrapping exception #619
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9fdfdcb
Added test app for (upcoming) batch exception fix. (master)
phillip-kruger 1d8c9a7
Batch exception fix when unwrapping exception
phillip-kruger 5a299b1
Update server/tck/src/test/java/io/smallrye/graphql/test/apps/batch/a…
phillip-kruger 9c2fc6f
Merge branch 'master' into master
phillip-kruger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
60 changes: 60 additions & 0 deletions
60
server/tck/src/test/java/io/smallrye/graphql/test/apps/batch/api/BatchApi.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,60 @@ | ||
package io.smallrye.graphql.test.apps.batch.api; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import org.eclipse.microprofile.graphql.Query; | ||
import org.eclipse.microprofile.graphql.Source; | ||
|
||
@GraphQLApi | ||
public class BatchApi { | ||
|
||
// Normal List Query | ||
@Query | ||
public List<BatchPojo> batchPojos() { | ||
List<BatchPojo> l = new ArrayList<>(); | ||
l.add(new BatchPojo(1)); | ||
l.add(new BatchPojo(2)); | ||
l.add(new BatchPojo(3)); | ||
l.add(new BatchPojo(4)); | ||
|
||
return l; | ||
} | ||
|
||
// Nornal Source | ||
phillip-kruger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public String greeting(@Source BatchPojo batchPojo) { | ||
return "hello"; | ||
} | ||
|
||
// Normal Batch Source | ||
public List<UUID> uuid(@Source List<BatchPojo> batchPojos) { | ||
List<UUID> uuids = new ArrayList<>(); | ||
for (BatchPojo batchPojo : batchPojos) { | ||
uuids.add(UUID.fromString("88aaea3a-a48c-46de-a675-d6f2a65a9b2" + batchPojo.id)); | ||
} | ||
return uuids; | ||
} | ||
|
||
// Runtime Exception Source | ||
public String runtime(@Source BatchPojo batchPojo) { | ||
throw new RuntimeException("Some runtime exception"); | ||
} | ||
|
||
// Runtime Exception Batch Source | ||
public List<String> runtimes(@Source List<BatchPojo> batchPojos) { | ||
throw new RuntimeException("Some runtimes exception"); | ||
} | ||
|
||
// Business Exception Source | ||
public String business(@Source BatchPojo batchPojo) throws BusinessException { | ||
throw new BusinessException("Some business exception"); | ||
} | ||
|
||
// Business Exception Batch Source | ||
public List<String> businesses(@Source List<BatchPojo> batchPojos) throws BusinessException { | ||
throw new BusinessException("Some businesses exception"); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
server/tck/src/test/java/io/smallrye/graphql/test/apps/batch/api/BatchPojo.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 io.smallrye.graphql.test.apps.batch.api; | ||
|
||
public class BatchPojo { | ||
|
||
public int id; | ||
|
||
public BatchPojo() { | ||
} | ||
|
||
public BatchPojo(int id) { | ||
this.id = id; | ||
} | ||
|
||
public String getSimpleField() { | ||
return "Some String"; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
server/tck/src/test/java/io/smallrye/graphql/test/apps/batch/api/BusinessException.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,24 @@ | ||
package io.smallrye.graphql.test.apps.batch.api; | ||
|
||
public class BusinessException extends Exception { | ||
|
||
public BusinessException() { | ||
} | ||
|
||
public BusinessException(String message) { | ||
super(message); | ||
} | ||
|
||
public BusinessException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public BusinessException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
server/tck/src/test/resources/tests/batch/error/input.graphql
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 @@ | ||
{ | ||
batchPojos{ | ||
business | ||
runtime | ||
businesses | ||
runtimes | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do this with an
ifPresent
block, but that's just a matter of taste, I guess.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is being deleted :)