-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #619 from phillip-kruger/master
Batch exception fix when unwrapping exception
- Loading branch information
Showing
17 changed files
with
504 additions
and
43 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
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; | ||
} | ||
|
||
// Normal Source | ||
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.