com.jayway.jsonpath.spi.mapper.MappingProvider Java Examples
The following examples show how to use
com.jayway.jsonpath.spi.mapper.MappingProvider.
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: EnrichIntegrationJsonPathTestCase.java From micro-integrator with Apache License 2.0 | 7 votes |
private void setJsonPathConfiguration() { Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new GsonJsonProvider(new GsonBuilder().serializeNulls().create()); private final MappingProvider mappingProvider = new GsonMappingProvider(); public JsonProvider jsonProvider() { return jsonProvider; } public MappingProvider mappingProvider() { return mappingProvider; } public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #2
Source File: CloudFoundryAcceptanceTest.java From spring-cloud-app-broker with Apache License 2.0 | 6 votes |
@BeforeEach void configureJsonPath() { Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jacksonJsonProvider = new JacksonJsonProvider(); private final MappingProvider jacksonMappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jacksonJsonProvider; } @Override public MappingProvider mappingProvider() { return jacksonMappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #3
Source File: LightServer.java From light with Apache License 2.0 | 6 votes |
static void configJsonPath() { Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #4
Source File: InterfaceTestApplication.java From interface-test with Apache License 2.0 | 6 votes |
@SuppressWarnings("WeakerAccess") public void init(){ // jsonpath配置初始化 com.jayway.jsonpath.Configuration.setDefaults(new com.jayway.jsonpath.Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #5
Source File: TestCaseLoaderTest.java From interface-test with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { com.jayway.jsonpath.Configuration.setDefaults(new com.jayway.jsonpath.Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #6
Source File: MaskTest.java From light-4j with Apache License 2.0 | 6 votes |
@BeforeClass public static void runOnceBeforeClass() { Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #7
Source File: JsonPathStartupHookProvider.java From light-4j with Apache License 2.0 | 6 votes |
static void configJsonPath() { Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #8
Source File: TestSchemaValidator.java From carbon-apimgt with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() { // Set GsonJsonProvider as the default Jayway JSON path default configuration // Which is set by synapse-core at runtime of the server Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new GsonJsonProvider(new GsonBuilder().serializeNulls().create()); private final MappingProvider mappingProvider = new GsonMappingProvider(); public JsonProvider jsonProvider() { return jsonProvider; } public MappingProvider mappingProvider() { return mappingProvider; } public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #9
Source File: ForEachnativeJSONTestCase.java From product-ei with Apache License 2.0 | 6 votes |
private void setJsonPathConfiguration() { Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new GsonJsonProvider(new GsonBuilder().serializeNulls().create()); private final MappingProvider mappingProvider = new GsonMappingProvider(); public JsonProvider jsonProvider() { return jsonProvider; } public MappingProvider mappingProvider() { return mappingProvider; } public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #10
Source File: EnrichIntegrationJsonPathTestCase.java From product-ei with Apache License 2.0 | 6 votes |
private void setJsonPathConfiguration() { Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new GsonJsonProvider(new GsonBuilder().serializeNulls().create()); private final MappingProvider mappingProvider = new GsonMappingProvider(); public JsonProvider jsonProvider() { return jsonProvider; } public MappingProvider mappingProvider() { return mappingProvider; } public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); }
Example #11
Source File: NashornTest.java From interface-test with Apache License 2.0 | 5 votes |
@Test public void test() throws ScriptException { com.jayway.jsonpath.Configuration.setDefaults(new com.jayway.jsonpath.Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); // DocumentContext doc = JsonPath.parse(this.getClass().getClassLoader().getResourceAsStream("nashorn.js")); //InvalidJsonException // TestSuit testSuit = doc.read("$", TestSuit.class); ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); ScriptEngine nashorn = scriptEngineManager.getEngineByName("nashorn"); nashorn.eval(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("nashorn.js")));//ScriptException->ParserException Object obj = nashorn.eval("JSON.stringify(testSuit)"); System.out.println(obj); }
Example #12
Source File: PackageUtils.java From lucene-solr with Apache License 2.0 | 4 votes |
public static Configuration jsonPathConfiguration() { MappingProvider provider = new JacksonMappingProvider(); JsonProvider jsonProvider = new JacksonJsonProvider(); Configuration c = Configuration.builder().jsonProvider(jsonProvider).mappingProvider(provider).options(com.jayway.jsonpath.Option.REQUIRE_PROPERTIES).build(); return c; }
Example #13
Source File: JsonExtractScalarTransformFunction.java From incubator-pinot with Apache License 2.0 | 4 votes |
@Override public MappingProvider mappingProvider() { return mappingProvider; }
Example #14
Source File: JsonExtractKeyTransformFunction.java From incubator-pinot with Apache License 2.0 | 4 votes |
@Override public MappingProvider mappingProvider() { return mappingProvider; }
Example #15
Source File: JSONMapParser.java From metron with Apache License 2.0 | 4 votes |
@Override public void configure(Map<String, Object> config) { setReadCharset(config); String strategyStr = (String) config.getOrDefault(MAP_STRATEGY_CONFIG, MapStrategy.DROP.name()); mapStrategy = MapStrategy.valueOf(strategyStr); overrideOriginalString = (Boolean) config.getOrDefault(OVERRIDE_ORIGINAL_STRING, false); if (config.containsKey(JSONP_QUERY)) { typeRef = new TypeRef<List<Map<String, Object>>>() { }; jsonpQuery = (String) config.get(JSONP_QUERY); if (!StringUtils.isBlank(jsonpQuery) && config.containsKey(WRAP_JSON)) { Object wrapObject = config.get(WRAP_JSON); if (wrapObject instanceof String) { wrapJson = Boolean.valueOf((String)wrapObject); } else if (wrapObject instanceof Boolean) { wrapJson = (Boolean) config.get(WRAP_JSON); } String entityName = (String)config.get(WRAP_ENTITY_NAME); if (!StringUtils.isBlank(entityName)) { wrapEntityName = entityName; } } Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.of(Option.SUPPRESS_EXCEPTIONS); } }); if (CacheProvider.getCache() == null) { CacheProvider.setCache(new LRUCache(100)); } } }
Example #16
Source File: Mtgjson4Provider.java From MtgDesktopCompanion with GNU General Public License v3.0 | 4 votes |
public void init() { logger.info("init " + this); chrono=new Chrono(); Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new GsonJsonProvider(); private final MappingProvider mappingProvider = new GsonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); Configuration.defaultConfiguration().addOptions(Option.DEFAULT_PATH_LEAF_TO_NULL); try { logger.debug("loading file " + fileSetJson); if (hasNewVersion()||!fileSetJson.exists() || fileSetJson.length() == 0 || getBoolean(FORCE_RELOAD)) { logger.info("Downloading "+version + " datafile"); URLTools.download(URL_JSON_ALL_SETS_ZIP, fileSetJsonTemp); FileTools.unZipIt(fileSetJsonTemp,fileSetJson); FileTools.saveFile(fversion,version); setProperty(FORCE_RELOAD, "false"); } Chrono chr = new Chrono(); chr.start(); logger.debug(this + " : parsing db file"); ctx = JsonPath.parse(fileSetJson); logger.debug(this + " : parsing OK in " + chr.stop()+"s"); } catch (Exception e1) { logger.error(e1); } }
Example #17
Source File: IronTestApplication.java From irontest with Apache License 2.0 | 4 votes |
@Override public void initialize(Bootstrap<IronTestConfiguration> bootstrap) { bootstrap.addCommand(new UpgradeCommand()); bootstrap.addBundle(new AssetsBundle("/assets/app", "/ui", "index.htm", "ui")); bootstrap.addBundle(new AssetsBundle("/META-INF/resources/webjars", "/ui/lib", null, "lib")); bootstrap.addBundle(new AssetsBundle("/assets/mockserver", "/ui/mockserver", "mockserver.htm", "mockserver")); bootstrap.addBundle(new AssetsBundle("/assets/common", "/ui/common", null, "common")); bootstrap.addBundle(jaxWsBundle); bootstrap.addBundle(new MultiPartBundle()); bootstrap.addBundle(new ViewBundle<IronTestConfiguration>(){ @Override public Map<String, Map<String, String>> getViewConfiguration(IronTestConfiguration config) { return config.getViewRendererConfiguration(); } }); Configuration.setDefaults(new Configuration.Defaults() { private final JsonProvider jsonProvider = new JacksonJsonProvider(); private final MappingProvider mappingProvider = new JacksonMappingProvider(); @Override public JsonProvider jsonProvider() { return jsonProvider; } @Override public MappingProvider mappingProvider() { return mappingProvider; } @Override public Set<Option> options() { return EnumSet.noneOf(Option.class); } }); // configure the Jackson ObjectMapper used by JAX-RS (Jersey) ObjectMapper objectMapper = bootstrap.getObjectMapper(); objectMapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION); IronTestUtils.addMixInsForWireMock(objectMapper); }
Example #18
Source File: ITER_CBOR.java From sparql-generate with Apache License 2.0 | 4 votes |
@Override public MappingProvider mappingProvider() { return mappingProvider; }
Example #19
Source File: ITER_JSONListKeys.java From sparql-generate with Apache License 2.0 | 4 votes |
@Override public MappingProvider mappingProvider() { return mappingProvider; }
Example #20
Source File: JsonPathProvider.java From bender with Apache License 2.0 | 4 votes |
@Override public MappingProvider mappingProvider() { return mappingProvider; }
Example #21
Source File: JsonUtils.java From karate with MIT License | 4 votes |
@Override public MappingProvider mappingProvider() { return mappingProvider; }
Example #22
Source File: Jackson.java From centraldogma with Apache License 2.0 | 4 votes |
@Override public MappingProvider mappingProvider() { return jsonPathCfg.mappingProvider(); }
Example #23
Source File: JsonPathUtils.java From vividus with Apache License 2.0 | 4 votes |
@Override public MappingProvider mappingProvider() { return jacksonMappingProvider; }