Skip to content

Commit 597922d

Browse files
committed
Test for Source.value
1 parent 0b45e19 commit 597922d

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/HeroFinder.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,19 @@ public Token generateSecretToken(@Source SuperHero hero,
616616
}
617617
}
618618

619+
public Token generateSuperSecretToken(@Source("superSecretToken") SuperHero hero,
620+
@DefaultValue("true") @Name("maskFirstPart") boolean maskFirstPart) throws GraphQLException {
621+
LOG.log(Level.INFO, "generateSuperSecretToken invoked [{0}],[{1}]", new Object[]{hero, maskFirstPart});
622+
623+
String uuid = UUID.randomUUID().toString();
624+
if (maskFirstPart) {
625+
return new Token(uuid.substring(0, uuid.length() - 4).replaceAll("[A-Za-z0-9]", "*")
626+
+ uuid.substring(uuid.length() - 4, uuid.length()));
627+
} else {
628+
return new Token(uuid);
629+
}
630+
}
631+
619632
@Mutation("setRivalTeam")
620633
public Team setRivalTeam(@Name("teamName") String teamName, @Name("rivalTeam") Team rivalTeam)
621634
throws UnknownTeamException {

tck/src/main/resources/tests/schemaTests.csv

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,25 @@
9393
50|type SuperHero | currentLocation: String | Expecting a currentLocation field in SuperHero due to Source annotation
9494
51|type Query | currentLocation(superHero: SuperHeroInput): String | Expecting a currentLocation query in Query to Source annotation
9595
52|type SuperHero | secretToken(maskFirstPart: Boolean = true): TopSecretToken | Expecting a secretToken field with a boolean argument in SuperHero due to Source annotation
96-
53|type Query | !secretToken(maskFirstPart: Boolean = true): TopSecretToken | Not expecting a secretToken query in Query
97-
54|type TopSecretToken | value: String | Expecting a TopSecretToken type, with a String value field
96+
53|type SuperHero | superSecretToken(maskFirstPart: Boolean = true): TopSecretToken | Expecting a superSecretToken field with a boolean argument in SuperHero due to Source annotation
97+
54|type Query | !secretToken(maskFirstPart: Boolean = true): TopSecretToken | Not expecting a secretToken query in Query
98+
55|type TopSecretToken | value: String | Expecting a TopSecretToken type, with a String value field
9899

99100
# testGetAndSetNotGetterAndSetter
100-
55|type Query | getaway: String | Expecting a getaway query where the get is not removed
101-
56|type Mutation | settlement: String | Expecting a settlement mutation where the set is not removed
101+
56|type Query | getaway: String | Expecting a getaway query where the get is not removed
102+
57|type Mutation | settlement: String | Expecting a settlement mutation where the set is not removed
102103

103104
# testDescription
104-
57|type Query | "Testing the blacklist of Checked Exceptions" | Expecting a description for the exportToFile query
105-
58|type Query | "Super hero name, not real name" | Expecting a description for the name parameter on the exportToFile query
105+
58|type Query | "Testing the blacklist of Checked Exceptions" | Expecting a description for the exportToFile query
106+
59|type Query | "Super hero name, not real name" | Expecting a description for the name parameter on the exportToFile query
106107

107108
# testJsonDefault
108-
59|type Mutation | provisionHero(hero: String, item: ItemInput = { | Expecting a default value for item for provisionHero
109-
60|type Mutation | id : 1000 | Expecting an id in the default value for item for provisionHero
110-
61|type Mutation | name : "Cape" | Expecting a name in the default value for item for provisionHero
111-
62|type Mutation | powerLevel : 3 | Expecting a powerLevel in the default value for item for provisionHero
112-
63|type Mutation | height : 1.2 | Expecting a height in the default value for item for provisionHero
113-
64|type Mutation | weight : 0.3 | Expecting a weight in the default value for item for provisionHero
114-
65|type Mutation | supernatural : false | Expecting a supernatural in the default value for item for provisionHero
115-
66|type Mutation | dateCreated : "19 February 1900 at 12:00 in Africa/Johannesburg" | Expecting a dateCreated in the default value for item for provisionHero
116-
67|type Mutation | dateLastUsed : "29 Jan 2020 at 09:45 in zone +0200" | Expecting a dateLastUsed in the default value for item for provisionHero
109+
60|type Mutation | provisionHero(hero: String, item: ItemInput = { | Expecting a default value for item for provisionHero
110+
61|type Mutation | id : 1000 | Expecting an id in the default value for item for provisionHero
111+
62|type Mutation | name : "Cape" | Expecting a name in the default value for item for provisionHero
112+
63|type Mutation | powerLevel : 3 | Expecting a powerLevel in the default value for item for provisionHero
113+
64|type Mutation | height : 1.2 | Expecting a height in the default value for item for provisionHero
114+
65|type Mutation | weight : 0.3 | Expecting a weight in the default value for item for provisionHero
115+
66|type Mutation | supernatural : false | Expecting a supernatural in the default value for item for provisionHero
116+
67|type Mutation | dateCreated : "19 February 1900 at 12:00 in Africa/Johannesburg" | Expecting a dateCreated in the default value for item for provisionHero
117+
68|type Mutation | dateLastUsed : "29 Jan 2020 at 09:45 in zone +0200" | Expecting a dateLastUsed in the default value for item for provisionHero

0 commit comments

Comments
 (0)