Skip to content

Commit

Permalink
Remove deprecated API usage
Browse files Browse the repository at this point in the history
Signed-off-by: Francis Galiegue <[email protected]>
  • Loading branch information
fge committed May 25, 2014
1 parent eef62f2 commit 597333b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.github.fge.jsonschema.core.tree.JsonTree;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
import com.github.fge.jsonschema.library.validator.DraftV3ValidatorDictionary;
import com.github.fge.jsonschema.messages.JsonSchemaValidationBundle;
Expand Down Expand Up @@ -81,7 +82,8 @@ public void initEnvironment()

final ObjectNode schema = FACTORY.objectNode();
schema.put("extends", FACTORY.objectNode());
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);

final JsonTree instance = new SimpleJsonTree(FACTORY.nullNode());
data = new FullData(tree, instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.github.fge.jsonschema.core.tree.JsonTree;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
import com.github.fge.jsonschema.library.validator.DraftV4ValidatorDictionary;
import com.github.fge.jsonschema.messages.JsonSchemaValidationBundle;
Expand Down Expand Up @@ -82,7 +83,8 @@ public void initEnvironment()
final ObjectNode schema = FACTORY.objectNode();
schema.put("not", FACTORY.objectNode());

final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final JsonTree instance = new SimpleJsonTree(FACTORY.nullNode());
data = new FullData(tree, instance);
report = mock(ProcessingReport.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.github.fge.jsonschema.core.tree.JsonTree;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
import com.github.fge.jsonschema.library.validator.CommonValidatorDictionary;
import com.github.fge.jsonschema.messages.JsonSchemaValidationBundle;
Expand Down Expand Up @@ -108,7 +109,8 @@ public void instancesAreValidatedCorrectly(final JsonNode schema,
throws IllegalAccessException, InvocationTargetException,
InstantiationException, ProcessingException
{
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final JsonTree instance = new SimpleJsonTree(node);
final FullData data = new FullData(tree, instance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.github.fge.jsonschema.core.report.ProcessingReport;
import com.github.fge.jsonschema.core.tree.CanonicalSchemaTree;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
import com.github.fge.jsonschema.core.util.Dictionary;
import com.github.fge.jsonschema.core.util.DictionaryBuilder;
import com.github.fge.jsonschema.keyword.digest.Digester;
Expand Down Expand Up @@ -100,7 +101,8 @@ public void onlyRelevantDigestsAreBuilt(final JsonNode node)
throws ProcessingException
{
final NodeType type = NodeType.getNodeType(node);
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final SchemaContext context = new SchemaContext(tree, type);
final ProcessingReport report = mock(ProcessingReport.class);

Expand Down Expand Up @@ -129,7 +131,8 @@ public void nonPresentKeywordDoesNotTriggerBuild()
{
final ObjectNode node = FACTORY.objectNode();
node.put(K1, K1);
final SchemaTree schemaTree = new CanonicalSchemaTree(node);
final SchemaTree schemaTree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), node);
final SchemaContext context
= new SchemaContext(schemaTree, NodeType.NULL);
final ProcessingReport report = mock(ProcessingReport.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.github.fge.jsonschema.core.tree.JsonTree;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
import com.github.fge.jsonschema.core.util.Dictionary;
import com.github.fge.jsonschema.format.FormatAttribute;
import com.github.fge.jsonschema.keyword.validator.KeywordValidator;
Expand Down Expand Up @@ -87,7 +88,8 @@ public void noFormatInSchemaIsANoOp()
throws ProcessingException
{
final ObjectNode schema = FACTORY.objectNode();
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final SchemaContext context = new SchemaContext(tree, NodeType.NULL);
final ValidatorList in = new ValidatorList(context,
Collections.<KeywordValidator>emptyList());
Expand All @@ -105,7 +107,8 @@ public void unknownFormatAttributesAreReportedAsWarnings()
{
final ObjectNode schema = FACTORY.objectNode();
schema.put("format", "foo");
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final SchemaContext context = new SchemaContext(tree, NodeType.NULL);
final ValidatorList in = new ValidatorList(context,
Collections.<KeywordValidator>emptyList());
Expand Down Expand Up @@ -133,7 +136,8 @@ public void attributeIsBeingAskedWhatIsSupports()
{
final ObjectNode schema = FACTORY.objectNode();
schema.put("format", FMT);
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final SchemaContext context = new SchemaContext(tree, NodeType.NULL);
final ValidatorList in = new ValidatorList(context,
Collections.<KeywordValidator>emptyList());
Expand All @@ -157,7 +161,8 @@ public void supportedNodeTypesTriggerAttributeBuild(final JsonNode node)
{
final ObjectNode schema = FACTORY.objectNode();
schema.put("format", FMT);
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final JsonTree instance = new SimpleJsonTree(node);
final FullData data = new FullData(tree, instance);
final SchemaContext context = new SchemaContext(data);
Expand Down Expand Up @@ -192,7 +197,8 @@ public void unsupportedTypeDoesNotTriggerValidatorBuild(final JsonNode node)
{
final ObjectNode schema = FACTORY.objectNode();
schema.put("format", FMT);
final SchemaTree tree = new CanonicalSchemaTree(schema);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final SchemaContext context
= new SchemaContext(tree, NodeType.getNodeType(node));
final ValidatorList in = new ValidatorList(context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.github.fge.jsonschema.core.tree.JsonTree;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.core.tree.SimpleJsonTree;
import com.github.fge.jsonschema.core.tree.key.SchemaKey;
import com.github.fge.jsonschema.keyword.validator.AbstractKeywordValidator;
import com.github.fge.jsonschema.library.DraftV4Library;
import com.github.fge.jsonschema.library.Keyword;
Expand Down Expand Up @@ -104,7 +105,8 @@ public void init()
public void childrenAreNotExploredByDefaultIfContainerFails()
throws ProcessingException
{
final SchemaTree schema = new CanonicalSchemaTree(RAWSCHEMA);
final SchemaTree schema
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), RAWSCHEMA);
final JsonTree instance = new SimpleJsonTree(RAWINSTANCE);
final FullData data = new FullData(schema, instance);
final ProcessingReport report = mock(ProcessingReport.class);
Expand All @@ -116,7 +118,8 @@ public void childrenAreNotExploredByDefaultIfContainerFails()
public void childrenAreExploredOnDemandEvenIfContainerFails()
throws ProcessingException
{
final SchemaTree schema = new CanonicalSchemaTree(RAWSCHEMA);
final SchemaTree schema
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), RAWSCHEMA);
final JsonTree instance = new SimpleJsonTree(RAWINSTANCE);
final FullData data = new FullData(schema, instance, true);
final ProcessingReport report = mock(ProcessingReport.class);
Expand Down

0 comments on commit 597333b

Please sign in to comment.