Search in sources :

Example 1 with AtlasJacksonModule

use of com.palantir.atlasdb.jackson.AtlasJacksonModule in project atlasdb by palantir.

the class TransactionRemotingTest method setupHacks.

@SuppressWarnings("unchecked")
@Before
public void setupHacks() throws Exception {
    Field field = dropwizard.getClass().getDeclaredField("testSupport");
    field.setAccessible(true);
    DropwizardTestSupport<Configuration> testSupport = (DropwizardTestSupport<Configuration>) field.get(dropwizard);
    ObjectMapper mapper = testSupport.getEnvironment().getObjectMapper();
    mapper.registerModule(new AtlasJacksonModule(cache).createModule());
    mapper.registerModule(new GuavaModule());
}
Also used : Field(java.lang.reflect.Field) Configuration(io.dropwizard.Configuration) AtlasJacksonModule(com.palantir.atlasdb.jackson.AtlasJacksonModule) DropwizardTestSupport(io.dropwizard.testing.DropwizardTestSupport) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GuavaModule(com.fasterxml.jackson.datatype.guava.GuavaModule) Before(org.junit.Before)

Example 2 with AtlasJacksonModule

use of com.palantir.atlasdb.jackson.AtlasJacksonModule in project atlasdb by palantir.

the class AtlasDbServiceServer method run.

@Override
public void run(AtlasDbServiceServerConfiguration config, final Environment environment) throws Exception {
    AtlasDbMetrics.setMetricRegistries(environment.metrics(), DefaultTaggedMetricRegistry.getDefault());
    SerializableTransactionManager tm = TransactionManagers.builder().config(config.getConfig()).userAgent("AtlasDbServiceServer").globalMetricsRegistry(environment.metrics()).globalTaggedMetricRegistry(DefaultTaggedMetricRegistry.getDefault()).registrar(environment.jersey()::register).build().serializable();
    TableMetadataCache cache = new TableMetadataCache(tm.getKeyValueService());
    environment.jersey().register(new AtlasDbServiceImpl(tm.getKeyValueService(), tm, cache));
    environment.getObjectMapper().registerModule(new AtlasJacksonModule(cache).createModule());
}
Also used : AtlasJacksonModule(com.palantir.atlasdb.jackson.AtlasJacksonModule) AtlasDbServiceImpl(com.palantir.atlasdb.impl.AtlasDbServiceImpl) SerializableTransactionManager(com.palantir.atlasdb.transaction.impl.SerializableTransactionManager) TableMetadataCache(com.palantir.atlasdb.impl.TableMetadataCache)

Aggregations

AtlasJacksonModule (com.palantir.atlasdb.jackson.AtlasJacksonModule)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 AtlasDbServiceImpl (com.palantir.atlasdb.impl.AtlasDbServiceImpl)1 TableMetadataCache (com.palantir.atlasdb.impl.TableMetadataCache)1 SerializableTransactionManager (com.palantir.atlasdb.transaction.impl.SerializableTransactionManager)1 Configuration (io.dropwizard.Configuration)1 DropwizardTestSupport (io.dropwizard.testing.DropwizardTestSupport)1 Field (java.lang.reflect.Field)1 Before (org.junit.Before)1