com.consol.citrus.validation.json.JsonMessageValidationContext Java Examples
The following examples show how to use
com.consol.citrus.validation.json.JsonMessageValidationContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebHookToFtp_IT.java From syndesis with Apache License 2.0 | 6 votes |
@Override public void doExecute(TestContext testContext) { Path publicUserDir = getFtpUserHome().resolve("public"); Assert.assertTrue( "Missing ftp user home directory", publicUserDir.toFile().exists()); File ftpUploadFile = publicUserDir.resolve(UPLOAD_FILENAME).toFile(); Assert.assertTrue(String.format("Missing ftp upload file '%s'", UPLOAD_FILENAME), ftpUploadFile.exists()); try { JsonTextMessageValidator validator = new JsonTextMessageValidator(); validator.validateMessage(new DefaultMessage(FileUtils.readToString(ftpUploadFile)), new DefaultMessage("{\"message\" : \"${first_name},${company},${email}\"}"), testContext, new JsonMessageValidationContext()); } catch (IOException e) { throw new CitrusRuntimeException(String.format("Failed to verify ftp upload file '%s'", UPLOAD_FILENAME), e); } }
Example #2
Source File: Verify.java From dew with Apache License 2.0 | 6 votes |
/** * Verify resource descriptors. * * @param message the message * @param expectedText the expected text * @param actualText the actual text * @throws IOException the io exception * @throws ParseException the parse exception */ default void verifyResourceDescriptors(String message, String expectedText, String actualText) throws IOException, ParseException { JsonTextMessageValidator validator = new JsonTextMessageValidator(); validator.setStrict(false); TestContext context = new TestContext(); context.getValidationMatcherRegistry() .getValidationMatcherLibraries() .add(new ValidationMatcherConfig().getValidationMatcherLibrary()); validator.validateJson(message, (JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(toJson(actualText)), (JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(toJson(expectedText)), new JsonMessageValidationContext(), context, JsonPath.parse(actualText)); }
Example #3
Source File: Verify.java From jkube with Eclipse Public License 2.0 | 5 votes |
public static void verifyResourceDescriptors(File actualPath, File expectedPath, boolean strict) throws IOException, ParseException { String actualText = readFile(actualPath); String expectedText = readFile(expectedPath); JsonTextMessageValidator validator = new JsonTextMessageValidator(); validator.setStrict(strict); DocumentContext actualContext = JsonPath.parse(actualText); validator.validateJson(newMessage(actualText), newMessage(expectedText), new JsonMessageValidationContext(), createTestContext(), actualContext); }
Example #4
Source File: Verify.java From jkube with Eclipse Public License 2.0 | 5 votes |
public static void verifyResourceDescriptors(File actualPath, File expectedPath, boolean strict) throws IOException, ParseException { String actualText = readFile(actualPath); String expectedText = readFile(expectedPath); JsonTextMessageValidator validator = new JsonTextMessageValidator(); validator.setStrict(strict); DocumentContext actualContext = JsonPath.parse(actualText); validator.validateJson(newMessage(actualText), newMessage(expectedText), new JsonMessageValidationContext(), createTestContext(), actualContext); }