use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project jvm-serializers by eishay.
the class JacksonCBORDatabind method register.
public static void register(TestGroups groups, boolean sharedNames, boolean sharedValues) {
CBORFactory factory = new CBORFactory();
// no point in using enum names with binary format, so:
ObjectMapper mapper = new ObjectMapper(factory);
groups.media.add(JavaBuiltIn.mediaTransformer, new StdJacksonDataBind<MediaContent>("cbor/jackson/databind", MediaContent.class, mapper), new SerFeatures(SerFormat.BIN_CROSSLANG, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, ""));
groups.media.add(JavaBuiltIn.mediaTransformer, new JacksonJsonManual("cbor/jackson/manual", factory), new SerFeatures(SerFormat.BIN_CROSSLANG, SerGraph.FLAT_TREE, SerClass.MANUAL_OPT, ""));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project jvm-serializers by eishay.
the class JacksonSmileDatabind method register.
public static void register(TestGroups groups, boolean sharedNames, boolean sharedValues) {
SmileFactory factory = new SmileFactory();
factory.configure(SmileGenerator.Feature.CHECK_SHARED_NAMES, sharedNames);
factory.configure(SmileGenerator.Feature.CHECK_SHARED_STRING_VALUES, sharedValues);
// no point in using enum names with binary format, so:
ObjectMapper mapper = new ObjectMapper(factory);
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_INDEX);
groups.media.add(JavaBuiltIn.mediaTransformer, new StdJacksonDataBind<MediaContent>("smile/jackson/databind", MediaContent.class, mapper), new SerFeatures(SerFormat.BINARY, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, ""));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project jvm-serializers by eishay.
the class JacksonWithAfterburner method registerCBOR.
public static void registerCBOR(TestGroups groups) {
ObjectMapper mapper = new ObjectMapper(new CBORFactory());
mapper.registerModule(new AfterburnerModule());
groups.media.add(JavaBuiltIn.mediaTransformer, new StdJacksonDataBind<MediaContent>("cbor/jackson+afterburner/databind", MediaContent.class, mapper), new SerFeatures(SerFormat.BINARY, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, STD_DESC));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project buck by facebook.
the class AndroidBinaryIntegrationTest method testReDexIsCalledAppropriatelyFromAndroidBinary.
@Test
public void testReDexIsCalledAppropriatelyFromAndroidBinary() throws IOException {
Path apk = workspace.buildAndReturnOutput(APP_REDEX_TARGET);
Path unzippedApk = unzip(apk.getParent(), apk, "app_redex");
// We use a fake ReDex binary that writes out the arguments it received as JSON so that we can
// verify that it was called in the right way.
ObjectMapper mapper = ObjectMappers.newDefaultInstance();
@SuppressWarnings("unchecked") Map<String, Object> userData = mapper.readValue(unzippedApk.toFile(), Map.class);
String androidSdk = (String) userData.get("ANDROID_SDK");
assertTrue("ANDROID_SDK environment variable must be set so ReDex runs with zipalign", androidSdk != null && !androidSdk.isEmpty());
assertEquals(workspace.getDestPath().toString(), userData.get("PWD"));
assertTrue(userData.get("config").toString().endsWith("apps/sample/redex-config.json"));
assertEquals("buck-out/gen/apps/sample/app_redex/proguard/seeds.txt", userData.get("keep"));
assertEquals("my_alias", userData.get("keyalias"));
assertEquals("android", userData.get("keypass"));
assertEquals(workspace.resolve("keystores/debug.keystore").toString(), userData.get("keystore"));
assertEquals("buck-out/gen/apps/sample/app_redex.apk.redex", userData.get("out"));
assertEquals("buck-out/gen/apps/sample/app_redex/proguard/command-line.txt", userData.get("P"));
assertEquals("buck-out/gen/apps/sample/app_redex/proguard/mapping.txt", userData.get("proguard-map"));
assertTrue((Boolean) userData.get("sign"));
assertEquals("my_param_name={\"foo\": true}", userData.get("J"));
assertTrue("redex_extra_args: -j $(location ...) is not properly expanded!", userData.get("j").toString().endsWith(".jar"));
assertTrue("redex_extra_args: -S $(location ...) is not properly expanded!", userData.get("S").toString().endsWith(".jar"));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper in project buck by facebook.
the class DexProducedFromJavaLibraryThatContainsClassFilesTest method getOutputDoesNotAccessWrappedJavaLibrary.
@Test
public void getOutputDoesNotAccessWrappedJavaLibrary() throws Exception {
BuildRuleResolver ruleResolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
JavaLibrary javaLibrary = JavaLibraryBuilder.createBuilder(BuildTargetFactory.newInstance("//:lib")).build(ruleResolver);
BuildRuleParams params = new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:target")).build();
DexProducedFromJavaLibrary dexProducedFromJavaLibrary = new DexProducedFromJavaLibrary(params, javaLibrary);
ObjectMapper mapper = ObjectMappers.newDefaultInstance();
FakeOnDiskBuildInfo onDiskBuildInfo = new FakeOnDiskBuildInfo().putMetadata(DexProducedFromJavaLibrary.WEIGHT_ESTIMATE, "0").putMetadata(DexProducedFromJavaLibrary.CLASSNAMES_TO_HASHES, mapper.writeValueAsString(ImmutableMap.<String, String>of()));
initialize(dexProducedFromJavaLibrary, onDiskBuildInfo);
assertFalse(dexProducedFromJavaLibrary.hasOutput());
}
Aggregations