use of com.netflix.conductor.common.utils.JsonMapperProvider in project conductor by Netflix.
the class JsonMapperProviderTest method testNullOnWrite.
@Test
public void testNullOnWrite() throws JsonProcessingException {
Map<String, Object> data = new HashMap<>();
data.put("someKey", null);
data.put("someId", "abc123");
ObjectMapper objectMapper = new JsonMapperProvider().get();
String result = objectMapper.writeValueAsString(data);
System.out.println(result);
assertTrue(result.contains("null"));
}
use of com.netflix.conductor.common.utils.JsonMapperProvider in project conductor by Netflix.
the class PerformanceTest method setUp.
@Before
public void setUp() {
TestConfiguration testConfiguration = new TestConfiguration();
configuration = new TestPostgresConfiguration(testConfiguration, "jdbc:postgresql://localhost:54320/conductor?charset=utf8&parseTime=true&interpolateParams=true", 10, 2);
PostgresDataSourceProvider dataSource = new PostgresDataSourceProvider(configuration);
this.dataSource = dataSource.get();
resetAllData(this.dataSource);
flywayMigrate(this.dataSource);
final ObjectMapper objectMapper = new JsonMapperProvider().get();
Q = new PostgresQueueDAO(objectMapper, this.dataSource);
E = new PostgresExecutionDAO(objectMapper, this.dataSource);
}
use of com.netflix.conductor.common.utils.JsonMapperProvider in project conductor by Netflix.
the class JsonUtils method fromJson.
public static <T> T fromJson(String fileName, Class<T> classObject) throws Exception {
ObjectMapper objectMapper = new JsonMapperProvider().get();
InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName);
return objectMapper.readValue(inputStream, classObject);
}
use of com.netflix.conductor.common.utils.JsonMapperProvider in project conductor by Netflix.
the class ExternalPayloadStorageUtilsTest method setup.
@Before
public void setup() {
externalPayloadStorage = mock(ExternalPayloadStorage.class);
Configuration configuration = new TestConfiguration();
objectMapper = new JsonMapperProvider().get();
location = new ExternalStorageLocation();
location.setPath("some/test/path");
externalPayloadStorageUtils = new ExternalPayloadStorageUtils(externalPayloadStorage, configuration, objectMapper);
}
use of com.netflix.conductor.common.utils.JsonMapperProvider in project conductor by Netflix.
the class JsonMapperProviderTest method testSimpleMapping.
@Test
public void testSimpleMapping() throws JsonGenerationException, JsonMappingException, IOException {
ObjectMapper m = new JsonMapperProvider().get();
assertTrue(m.canSerialize(Any.class));
Struct struct1 = Struct.newBuilder().putFields("some-key", Value.newBuilder().setStringValue("some-value").build()).build();
Any source = Any.pack(struct1);
StringWriter buf = new StringWriter();
m.writer().writeValue(buf, source);
Any dest = m.reader().forType(Any.class).readValue(buf.toString());
assertEquals(source.getTypeUrl(), dest.getTypeUrl());
Struct struct2 = dest.unpack(Struct.class);
assertTrue(struct2.containsFields("some-key"));
assertEquals(struct1.getFieldsOrThrow("some-key").getStringValue(), struct2.getFieldsOrThrow("some-key").getStringValue());
}
Aggregations