Skip to content

Commit 597333b

Browse files
committed
Remove deprecated API usage
Signed-off-by: Francis Galiegue <[email protected]>
1 parent eef62f2 commit 597333b

File tree

6 files changed

+30
-12
lines changed

6 files changed

+30
-12
lines changed

src/test/java/com/github/fge/jsonschema/keyword/special/ExtendsKeywordTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.github.fge.jsonschema.core.tree.JsonTree;
3232
import com.github.fge.jsonschema.core.tree.SchemaTree;
3333
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
34+
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
3435
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
3536
import com.github.fge.jsonschema.library.validator.DraftV3ValidatorDictionary;
3637
import com.github.fge.jsonschema.messages.JsonSchemaValidationBundle;
@@ -81,7 +82,8 @@ public void initEnvironment()
8182

8283
final ObjectNode schema = FACTORY.objectNode();
8384
schema.put("extends", FACTORY.objectNode());
84-
final SchemaTree tree = new CanonicalSchemaTree(schema);
85+
final SchemaTree tree
86+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
8587

8688
final JsonTree instance = new SimpleJsonTree(FACTORY.nullNode());
8789
data = new FullData(tree, instance);

src/test/java/com/github/fge/jsonschema/keyword/special/NotKeywordTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.github.fge.jsonschema.core.tree.JsonTree;
3333
import com.github.fge.jsonschema.core.tree.SchemaTree;
3434
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
35+
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
3536
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
3637
import com.github.fge.jsonschema.library.validator.DraftV4ValidatorDictionary;
3738
import com.github.fge.jsonschema.messages.JsonSchemaValidationBundle;
@@ -82,7 +83,8 @@ public void initEnvironment()
8283
final ObjectNode schema = FACTORY.objectNode();
8384
schema.put("not", FACTORY.objectNode());
8485

85-
final SchemaTree tree = new CanonicalSchemaTree(schema);
86+
final SchemaTree tree
87+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
8688
final JsonTree instance = new SimpleJsonTree(FACTORY.nullNode());
8789
data = new FullData(tree, instance);
8890
report = mock(ProcessingReport.class);

src/test/java/com/github/fge/jsonschema/keyword/special/PatternKeywordTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.github.fge.jsonschema.core.tree.JsonTree;
3232
import com.github.fge.jsonschema.core.tree.SchemaTree;
3333
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
34+
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
3435
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
3536
import com.github.fge.jsonschema.library.validator.CommonValidatorDictionary;
3637
import com.github.fge.jsonschema.messages.JsonSchemaValidationBundle;
@@ -108,7 +109,8 @@ public void instancesAreValidatedCorrectly(final JsonNode schema,
108109
throws IllegalAccessException, InvocationTargetException,
109110
InstantiationException, ProcessingException
110111
{
111-
final SchemaTree tree = new CanonicalSchemaTree(schema);
112+
final SchemaTree tree
113+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
112114
final JsonTree instance = new SimpleJsonTree(node);
113115
final FullData data = new FullData(tree, instance);
114116

src/test/java/com/github/fge/jsonschema/processors/digest/SchemaDigesterTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.github.fge.jsonschema.core.report.ProcessingReport;
3030
import com.github.fge.jsonschema.core.tree.CanonicalSchemaTree;
3131
import com.github.fge.jsonschema.core.tree.SchemaTree;
32+
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
3233
import com.github.fge.jsonschema.core.util.Dictionary;
3334
import com.github.fge.jsonschema.core.util.DictionaryBuilder;
3435
import com.github.fge.jsonschema.keyword.digest.Digester;
@@ -100,7 +101,8 @@ public void onlyRelevantDigestsAreBuilt(final JsonNode node)
100101
throws ProcessingException
101102
{
102103
final NodeType type = NodeType.getNodeType(node);
103-
final SchemaTree tree = new CanonicalSchemaTree(schema);
104+
final SchemaTree tree
105+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
104106
final SchemaContext context = new SchemaContext(tree, type);
105107
final ProcessingReport report = mock(ProcessingReport.class);
106108

@@ -129,7 +131,8 @@ public void nonPresentKeywordDoesNotTriggerBuild()
129131
{
130132
final ObjectNode node = FACTORY.objectNode();
131133
node.put(K1, K1);
132-
final SchemaTree schemaTree = new CanonicalSchemaTree(node);
134+
final SchemaTree schemaTree
135+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), node);
133136
final SchemaContext context
134137
= new SchemaContext(schemaTree, NodeType.NULL);
135138
final ProcessingReport report = mock(ProcessingReport.class);

src/test/java/com/github/fge/jsonschema/processors/format/FormatProcessorTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.github.fge.jsonschema.core.tree.JsonTree;
3434
import com.github.fge.jsonschema.core.tree.SchemaTree;
3535
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
36+
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
3637
import com.github.fge.jsonschema.core.util.Dictionary;
3738
import com.github.fge.jsonschema.format.FormatAttribute;
3839
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
@@ -87,7 +88,8 @@ public void noFormatInSchemaIsANoOp()
8788
throws ProcessingException
8889
{
8990
final ObjectNode schema = FACTORY.objectNode();
90-
final SchemaTree tree = new CanonicalSchemaTree(schema);
91+
final SchemaTree tree
92+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
9193
final SchemaContext context = new SchemaContext(tree, NodeType.NULL);
9294
final ValidatorList in = new ValidatorList(context,
9395
Collections.<KeywordValidator>emptyList());
@@ -105,7 +107,8 @@ public void unknownFormatAttributesAreReportedAsWarnings()
105107
{
106108
final ObjectNode schema = FACTORY.objectNode();
107109
schema.put("format", "foo");
108-
final SchemaTree tree = new CanonicalSchemaTree(schema);
110+
final SchemaTree tree
111+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
109112
final SchemaContext context = new SchemaContext(tree, NodeType.NULL);
110113
final ValidatorList in = new ValidatorList(context,
111114
Collections.<KeywordValidator>emptyList());
@@ -133,7 +136,8 @@ public void attributeIsBeingAskedWhatIsSupports()
133136
{
134137
final ObjectNode schema = FACTORY.objectNode();
135138
schema.put("format", FMT);
136-
final SchemaTree tree = new CanonicalSchemaTree(schema);
139+
final SchemaTree tree
140+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
137141
final SchemaContext context = new SchemaContext(tree, NodeType.NULL);
138142
final ValidatorList in = new ValidatorList(context,
139143
Collections.<KeywordValidator>emptyList());
@@ -157,7 +161,8 @@ public void supportedNodeTypesTriggerAttributeBuild(final JsonNode node)
157161
{
158162
final ObjectNode schema = FACTORY.objectNode();
159163
schema.put("format", FMT);
160-
final SchemaTree tree = new CanonicalSchemaTree(schema);
164+
final SchemaTree tree
165+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
161166
final JsonTree instance = new SimpleJsonTree(node);
162167
final FullData data = new FullData(tree, instance);
163168
final SchemaContext context = new SchemaContext(data);
@@ -192,7 +197,8 @@ public void unsupportedTypeDoesNotTriggerValidatorBuild(final JsonNode node)
192197
{
193198
final ObjectNode schema = FACTORY.objectNode();
194199
schema.put("format", FMT);
195-
final SchemaTree tree = new CanonicalSchemaTree(schema);
200+
final SchemaTree tree
201+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
196202
final SchemaContext context
197203
= new SchemaContext(tree, NodeType.getNodeType(node));
198204
final ValidatorList in = new ValidatorList(context,

src/test/java/com/github/fge/jsonschema/processors/validation/ValidationProcessorTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.github.fge.jsonschema.core.tree.JsonTree;
3939
import com.github.fge.jsonschema.core.tree.SchemaTree;
4040
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
41+
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
4142
import com.github.fge.jsonschema.keyword.validator.AbstractKeywordValidator;
4243
import com.github.fge.jsonschema.library.DraftV4Library;
4344
import com.github.fge.jsonschema.library.Keyword;
@@ -104,7 +105,8 @@ public void init()
104105
public void childrenAreNotExploredByDefaultIfContainerFails()
105106
throws ProcessingException
106107
{
107-
final SchemaTree schema = new CanonicalSchemaTree(RAWSCHEMA);
108+
final SchemaTree schema
109+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), RAWSCHEMA);
108110
final JsonTree instance = new SimpleJsonTree(RAWINSTANCE);
109111
final FullData data = new FullData(schema, instance);
110112
final ProcessingReport report = mock(ProcessingReport.class);
@@ -116,7 +118,8 @@ public void childrenAreNotExploredByDefaultIfContainerFails()
116118
public void childrenAreExploredOnDemandEvenIfContainerFails()
117119
throws ProcessingException
118120
{
119-
final SchemaTree schema = new CanonicalSchemaTree(RAWSCHEMA);
121+
final SchemaTree schema
122+
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), RAWSCHEMA);
120123
final JsonTree instance = new SimpleJsonTree(RAWINSTANCE);
121124
final FullData data = new FullData(schema, instance, true);
122125
final ProcessingReport report = mock(ProcessingReport.class);

0 commit comments

Comments
 (0)