Skip to content

Commit 81df6ed

Browse files
authored
Merge pull request #212 from networknt/issue211
fixes #211 move the current test cases from tests to draft4 folder in…
2 parents d16a005 + 4af02c8 commit 81df6ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+54
-54
lines changed

src/test/java/com/networknt/schema/JsonSchemaTest.java

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static void setUp() {
5252
server = Undertow.builder()
5353
.addHttpListener(1234, "localhost")
5454
.setHandler(resource(new FileResourceManager(
55-
new File("./src/test/resources/tests"), 100)))
55+
new File("./src/test/resources/draft4"), 100)))
5656
.build();
5757
server.start();
5858
}
@@ -136,198 +136,198 @@ public void testLoadingWithId() throws Exception {
136136

137137
@Test
138138
public void testBignumValidator() throws Exception {
139-
runTestFile("tests/optional/bignum.json");
139+
runTestFile("draft4/optional/bignum.json");
140140
}
141141

142142
@Test
143143
public void testFormatValidator() throws Exception {
144-
runTestFile("tests/optional/format.json");
144+
runTestFile("draft4/optional/format.json");
145145
}
146146

147147
@Test
148148
public void testComplexSchema() throws Exception {
149-
runTestFile("tests/optional/complex.json");
149+
runTestFile("draft4/optional/complex.json");
150150
}
151151

152152
@Test
153153
public void testZeroTerminatedFloatsValidator() throws Exception {
154-
runTestFile("tests/optional/zeroTerminatedFloats.json");
154+
runTestFile("draft4/optional/zeroTerminatedFloats.json");
155155
}
156156

157157
@Test
158158
public void testAdditionalItemsValidator() throws Exception {
159-
runTestFile("tests/additionalItems.json");
159+
runTestFile("draft4/additionalItems.json");
160160
}
161161

162162
@Test
163163
public void testAdditionalPropertiesValidator() throws Exception {
164-
runTestFile("tests/additionalProperties.json");
164+
runTestFile("draft4/additionalProperties.json");
165165
}
166166

167167
@Test
168168
public void testAllOfValidator() throws Exception {
169-
runTestFile("tests/allOf.json");
169+
runTestFile("draft4/allOf.json");
170170
}
171171

172172
@Test
173173
public void testAnyOFValidator() throws Exception {
174-
runTestFile("tests/anyOf.json");
174+
runTestFile("draft4/anyOf.json");
175175
}
176176

177177
@Test
178178
public void testDefaultValidator() throws Exception {
179-
runTestFile("tests/default.json");
179+
runTestFile("draft4/default.json");
180180
}
181181

182182
@Test
183183
public void testDefinitionsValidator() throws Exception {
184-
runTestFile("tests/definitions.json");
184+
runTestFile("draft4/definitions.json");
185185
}
186186

187187
@Test
188188
public void testDependenciesValidator() throws Exception {
189-
runTestFile("tests/dependencies.json");
189+
runTestFile("draft4/dependencies.json");
190190
}
191191

192192
@Test
193193
public void testEnumValidator() throws Exception {
194-
runTestFile("tests/enum.json");
194+
runTestFile("draft4/enum.json");
195195
}
196196

197197
@Test
198198
public void testItemsValidator() throws Exception {
199-
runTestFile("tests/items.json");
199+
runTestFile("draft4/items.json");
200200
}
201201

202202
@Test
203203
public void testMaximumValidator() throws Exception {
204-
runTestFile("tests/maximum.json");
204+
runTestFile("draft4/maximum.json");
205205
}
206206

207207
@Test
208208
public void testMaxItemsValidator() throws Exception {
209-
runTestFile("tests/maxItems.json");
209+
runTestFile("draft4/maxItems.json");
210210
}
211211

212212
@Test
213213
public void testMaxLengthValidator() throws Exception {
214-
runTestFile("tests/maxLength.json");
214+
runTestFile("draft4/maxLength.json");
215215
}
216216

217217
@Test
218218
public void testMaxPropertiesValidator() throws Exception {
219-
runTestFile("tests/maxProperties.json");
219+
runTestFile("draft4/maxProperties.json");
220220
}
221221

222222
@Test
223223
public void testMinimumValidator() throws Exception {
224-
runTestFile("tests/minimum.json");
224+
runTestFile("draft4/minimum.json");
225225
}
226226

227227
@Test
228228
public void testMinItemsValidator() throws Exception {
229-
runTestFile("tests/minItems.json");
229+
runTestFile("draft4/minItems.json");
230230
}
231231

232232
@Test
233233
public void testMinLengthValidator() throws Exception {
234-
runTestFile("tests/minLength.json");
234+
runTestFile("draft4/minLength.json");
235235
}
236236

237237
@Test
238238
public void testMinPropertiesValidator() throws Exception {
239-
runTestFile("tests/minProperties.json");
239+
runTestFile("draft4/minProperties.json");
240240
}
241241

242242
@Test
243243
public void testMultipleOfValidator() throws Exception {
244-
runTestFile("tests/multipleOf.json");
244+
runTestFile("draft4/multipleOf.json");
245245
}
246246

247247
@Test
248248
public void testNotValidator() throws Exception {
249-
runTestFile("tests/not.json");
249+
runTestFile("draft4/not.json");
250250
}
251251

252252
@Test
253253
public void testOneOfValidator() throws Exception {
254-
runTestFile("tests/oneOf.json");
254+
runTestFile("draft4/oneOf.json");
255255
}
256256

257257
@Test
258258
public void testPatternValidator() throws Exception {
259-
runTestFile("tests/pattern.json");
259+
runTestFile("draft4/pattern.json");
260260
}
261261

262262
@Test
263263
public void testPatternPropertiesValidator() throws Exception {
264-
runTestFile("tests/patternProperties.json");
264+
runTestFile("draft4/patternProperties.json");
265265
}
266266

267267
@Test
268268
public void testPropertiesValidator() throws Exception {
269-
runTestFile("tests/properties.json");
269+
runTestFile("draft4/properties.json");
270270
}
271271

272272
@Test
273273
public void testRefValidator() throws Exception {
274-
runTestFile("tests/ref.json");
274+
runTestFile("draft4/ref.json");
275275
}
276276

277277
@Test
278278
public void testRefRemoteValidator() throws Exception {
279-
runTestFile("tests/refRemote.json");
279+
runTestFile("draft4/refRemote.json");
280280
}
281281

282282
@Test
283283
public void testRelativeRefRemoteValidator() throws Exception {
284-
runTestFile("tests/relativeRefRemote.json");
284+
runTestFile("draft4/relativeRefRemote.json");
285285
}
286286

287287
@Test
288288
public void testRequiredValidator() throws Exception {
289-
runTestFile("tests/required.json");
289+
runTestFile("draft4/required.json");
290290
}
291291

292292

293293
@Test
294294
public void testTypeValidator() throws Exception {
295-
runTestFile("tests/type.json");
295+
runTestFile("draft4/type.json");
296296
}
297297

298298
@Test
299299
public void testUnionTypeValidator() throws Exception {
300-
runTestFile("tests/union_type.json");
300+
runTestFile("draft4/union_type.json");
301301
}
302302

303303
@Test
304304
public void testUniqueItemsValidator() throws Exception {
305-
runTestFile("tests/uniqueItems.json");
305+
runTestFile("draft4/uniqueItems.json");
306306
}
307307

308308
@Test
309309
public void testEnumObject() throws Exception {
310-
runTestFile("tests/enumObject.json");
310+
runTestFile("draft4/enumObject.json");
311311
}
312312

313313
@Test
314314
public void testIdSchemaWithUrl() throws Exception {
315-
runTestFile("tests/id_schema/property.json");
315+
runTestFile("draft4/id_schema/property.json");
316316
}
317317

318318
@Test
319319
public void testSchemaFromClasspath() throws Exception {
320-
runTestFile("tests/classpath/schema.json");
320+
runTestFile("draft4/classpath/schema.json");
321321
}
322322

323323
@Test
324324
public void testUUIDValidator() throws Exception {
325-
runTestFile("tests/uuid.json");
325+
runTestFile("draft4/uuid.json");
326326
}
327327

328328
@Test
329329
public void testIfValidator() throws Exception {
330-
runTestFile("tests/if.json");
330+
runTestFile("draft4/if.json");
331331
}
332332

333333
/**
@@ -402,7 +402,7 @@ private Set<ValidationMessage> validateFailingFastSchemaFor(final String schemaF
402402
private JsonNode getJsonNodeFromResource(final ObjectMapper mapper, final String locationInTestResources) throws IOException {
403403
return mapper.readTree(
404404
Thread.currentThread().getContextClassLoader()
405-
.getResourceAsStream("tests" + System.getProperty("file.separator") + locationInTestResources));
405+
.getResourceAsStream("draft4" + System.getProperty("file.separator") + locationInTestResources));
406406

407407
}
408408
}

src/test/java/com/networknt/schema/UriMappingTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ public class UriMappingTest {
3535
@Test
3636
public void testBuilderUriMappingUri() throws IOException {
3737
URL mappings = ClasspathURLFactory.convert(
38-
this.classpathURLFactory.create("resource:tests/uri_mapping/uri-mapping.json"));
38+
this.classpathURLFactory.create("resource:draft4/uri_mapping/uri-mapping.json"));
3939
JsonMetaSchema draftV4 = JsonMetaSchema.getDraftV4();
4040
Builder builder = JsonSchemaFactory.builder()
4141
.defaultMetaSchemaURI(draftV4.getUri())
4242
.addMetaSchema(draftV4)
4343
.addUriMappings(getUriMappingsFromUrl(mappings));
4444
JsonSchemaFactory instance = builder.build();
4545
JsonSchema schema = instance.getSchema(this.urlFactory.create(
46-
"https://raw.githubusercontent.com/networknt/json-schema-validator/master/src/test/resources/tests/uri_mapping/uri-mapping.schema.json"));
46+
"https://raw.githubusercontent.com/networknt/json-schema-validator/master/src/test/resources/draft4/uri_mapping/uri-mapping.schema.json"));
4747
assertEquals(0, schema.validate(mapper.readTree(mappings)).size());
4848
}
4949

@@ -74,7 +74,7 @@ public void testBuilderExampleMappings() throws IOException {
7474
fail("Unexpected exception thrown");
7575
}
7676
URL mappings = ClasspathURLFactory.convert(
77-
this.classpathURLFactory.create("resource:tests/uri_mapping/invalid-schema-uri.json"));
77+
this.classpathURLFactory.create("resource:draft4/uri_mapping/invalid-schema-uri.json"));
7878
JsonMetaSchema draftV4 = JsonMetaSchema.getDraftV4();
7979
Builder builder = JsonSchemaFactory.builder()
8080
.defaultMetaSchemaURI(draftV4.getUri())
@@ -95,7 +95,7 @@ public void testBuilderExampleMappings() throws IOException {
9595
public void testValidatorConfigUriMappingUri() throws IOException {
9696
JsonSchemaFactory instance = JsonSchemaFactory.getInstance();
9797
URL mappings = ClasspathURLFactory.convert(
98-
this.classpathURLFactory.create("resource:tests/uri_mapping/uri-mapping.json"));
98+
this.classpathURLFactory.create("resource:draft4/uri_mapping/uri-mapping.json"));
9999
SchemaValidatorsConfig config = new SchemaValidatorsConfig();
100100
config.setUriMappings(getUriMappingsFromUrl(mappings));
101101
JsonSchema schema = instance.getSchema(this.urlFactory.create(
@@ -132,7 +132,7 @@ public void testValidatorConfigExampleMappings() throws IOException {
132132
fail("Unexpected exception thrown");
133133
}
134134
URL mappings = ClasspathURLFactory.convert(
135-
this.classpathURLFactory.create("resource:tests/uri_mapping/invalid-schema-uri.json"));
135+
this.classpathURLFactory.create("resource:draft4/uri_mapping/invalid-schema-uri.json"));
136136
config.setUriMappings(getUriMappingsFromUrl(mappings));
137137
JsonSchema schema = instance.getSchema(example, config);
138138
assertEquals(0, schema.validate(mapper.createObjectNode()).size());
@@ -142,10 +142,10 @@ public void testValidatorConfigExampleMappings() throws IOException {
142142
public void testMappingsForRef() throws IOException {
143143
JsonSchemaFactory instance = JsonSchemaFactory.getInstance();
144144
URL mappings = ClasspathURLFactory.convert(
145-
this.classpathURLFactory.create("resource:tests/uri_mapping/schema-with-ref-mapping.json"));
145+
this.classpathURLFactory.create("resource:draft4/uri_mapping/schema-with-ref-mapping.json"));
146146
SchemaValidatorsConfig config = new SchemaValidatorsConfig();
147147
config.setUriMappings(getUriMappingsFromUrl(mappings));
148-
JsonSchema schema = instance.getSchema(this.classpathURLFactory.create("resource:tests/uri_mapping/schema-with-ref.json"),
148+
JsonSchema schema = instance.getSchema(this.classpathURLFactory.create("resource:draft4/uri_mapping/schema-with-ref.json"),
149149
config);
150150
assertEquals(0, schema.validate(mapper.readTree("[]")).size());
151151
}

src/test/resources/tests/classpath/schema.json renamed to src/test/resources/draft4/classpath/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"description": "Sub schema in classpath",
44
"schema": {
5-
"id": "classpath:/tests/classpath/sub-schema.json",
5+
"id": "classpath:/draft4/classpath/sub-schema.json",
66
"type": "object",
77
"properties": {
88
"features": {

0 commit comments

Comments
 (0)