@Test public void canDeserializeV1Metadata() throws URISyntaxException, IOException { String resourcePath = getResourcePath("internalschema-persistence/metadata-v1-1.json"); byte[] bytes = Files.readAllBytes(Paths.get(resourcePath)); VersionedInternalSchemaMetadata versionedInternalSchemaMetadata = ObjectMappers.newServerObjectMapper().readValue(bytes, VersionedInternalSchemaMetadata.class); assertThat(InternalSchemaMetadataPayloadCodec.decode(versionedInternalSchemaMetadata)) .isEqualTo(INTERNAL_SCHEMA_METADATA); }
/** * Returns a default ObjectMapper with settings adjusted for use in clients. * <p> * Settings: * <ul> * <li>Ignore unknown properties found during deserialization. * </ul> */ public static ObjectMapper newClientObjectMapper() { return withDefaultModules(new ObjectMapper()) .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); }
/** * Returns result of {@link #newClientObjectMapper()}. This method maintains source and binary * compatibility with previous releases of the 2.x branch. * * @deprecated use {@link #newClientObjectMapper()} instead. */ @Deprecated public static ObjectMapper guavaJdk7Jdk8() { return newClientObjectMapper(); }
context.register(new JacksonCBORProvider(ObjectMappers.newCborServerObjectMapper()));
/** * Returns a default ObjectMapper with settings adjusted for use in servers. * <p> * Settings: * <ul> * <li>Throw on unknown properties found during deserialization. * </ul> */ public static ObjectMapper newServerObjectMapper() { return withDefaultModules(new ObjectMapper()) .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); }
public static CoordinationService<InternalSchemaMetadata> createDefault( KeyValueService keyValueService, LongSupplier timestampSupplier, boolean initializeAsync) { CoordinationService<VersionedInternalSchemaMetadata> versionedService = new CoordinationServiceImpl<>( KeyValueServiceCoordinationStore.create( ObjectMappers.newServerObjectMapper(), keyValueService, AtlasDbConstants.DEFAULT_METADATA_COORDINATION_KEY, timestampSupplier, VersionedInternalSchemaMetadata.class, initializeAsync)); return wrapHidingVersionSerialization(versionedService); } }
/** * Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in servers. * <p> * Settings: * <ul> * <li>Throw on unknown properties found during deserialization. * </ul> */ public static ObjectMapper newCborServerObjectMapper() { return withDefaultModules(new ObjectMapper(new CBORFactory())) .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); }
@Test public void multipleStoresCanCoexist() { byte[] otherCoordinationKey = PtBytes.toBytes("bbbbb"); CoordinationStore<String> otherCoordinationStore = KeyValueServiceCoordinationStore.create( ObjectMappers.newServerObjectMapper(), keyValueService, otherCoordinationKey, timestampSequence::incrementAndGet, String.class, false); coordinationStore.transformAgreedValue(unused -> VALUE_1); otherCoordinationStore.transformAgreedValue(unused -> VALUE_2); assertThat(coordinationStore.getAgreedValue().get().value()).contains(VALUE_1); assertThat(otherCoordinationStore.getAgreedValue().get().value()).contains(VALUE_2); } }
/** * Returns a default ObjectMapper which uses the cbor factory with settings adjusted for use in clients. * <p> * Settings: * <ul> * <li>Ignore unknown properties found during deserialization. * </ul> */ public static ObjectMapper newCborClientObjectMapper() { return withDefaultModules(new ObjectMapper(new CBORFactory())) .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); }
private static TransactionSchemaManager createTransactionSchemaManager(TimestampService ts) { CoordinationServiceImpl<VersionedInternalSchemaMetadata> rawService = new CoordinationServiceImpl<>( KeyValueServiceCoordinationStore.create( ObjectMappers.newServerObjectMapper(), new InMemoryKeyValueService(true), PtBytes.toBytes("aaa"), ts::getFreshTimestamp, VersionedInternalSchemaMetadata.class, false)); return new TransactionSchemaManager(CoordinationServices.wrapHidingVersionSerialization(rawService)); }
public static CoordinationService<InternalSchemaMetadata> createDefault( KeyValueService keyValueService, LongSupplier timestampSupplier, boolean initializeAsync) { CoordinationService<VersionedInternalSchemaMetadata> versionedService = new CoordinationServiceImpl<>( KeyValueServiceCoordinationStore.create( ObjectMappers.newServerObjectMapper(), keyValueService, AtlasDbConstants.DEFAULT_METADATA_COORDINATION_KEY, timestampSupplier, VersionedInternalSchemaMetadata.class, initializeAsync)); return wrapHidingVersionSerialization(versionedService); } }