use of com.fasterxml.jackson.dataformat.xml.XmlMapper in project dhis2-core by dhis2.
the class JobConfigurationSerializationTest method xmlWithEmptyArray.
@Test
void xmlWithEmptyArray() throws IOException {
final XmlMapper xmlMapper = new XmlMapper();
xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
xmlMapper.configure(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY, false);
JobConfiguration jc = xmlMapper.readValue("<jobConfiguration lastUpdated=\"2019-03-26T22:57:44.649\" id=\"uB9oC4R2nTn\" created=\"2019-03-26T22:57:44.649\" name=\"Test Analytic\">\n" + " <jobStatus>SCHEDULED</jobStatus>\n" + " <displayName>Test Analytic</displayName>\n" + " <enabled>true</enabled>\n" + " <leaderOnlyJob>true</leaderOnlyJob>\n" + " <externalAccess>false</externalAccess>\n" + " <jobType>ANALYTICS_TABLE</jobType>\n" + " <nextExecutionTime>2019-03-27T12:00:00.000</nextExecutionTime>\n" + " <favorite>false</favorite>\n" + " <configurable>true</configurable>\n" + " <access>\n" + " <read>true</read>\n" + " <update>true</update>\n" + " <externalize>false</externalize>\n" + " <delete>true</delete>\n" + " <write>true</write>\n" + " <manage>true</manage>\n" + " </access>\n" + " <lastUpdatedBy id=\"xE7jOejl9FI\"/>\n" + " <jobParameters>\n" + " <lastYears>2</lastYears>\n" + " <skipResourceTables>true</skipResourceTables>\n" + " <skipTableTypes>\n" + " </skipTableTypes>" + " <skipPrograms>\n" + " </skipPrograms>" + " </jobParameters>\n" + " <cronExpression>0 0 12 ? * MON-FRI</cronExpression>\n" + " </jobConfiguration>", JobConfiguration.class);
assertEquals("uB9oC4R2nTn", jc.getUid());
assertEquals(JobStatus.SCHEDULED, jc.getJobStatus());
assertEquals("Test Analytic", jc.getName());
assertEquals("Test Analytic", jc.getDisplayName());
assertTrue(jc.isEnabled());
assertTrue(jc.isLeaderOnlyJob());
assertEquals(JobType.ANALYTICS_TABLE, jc.getJobType());
assertNull(jc.getNextExecutionTime());
assertEquals("0 0 12 ? * MON-FRI", jc.getCronExpression());
assertNotNull(jc.getJobParameters());
assertEquals((Integer) 2, ((AnalyticsJobParameters) jc.getJobParameters()).getLastYears());
assertTrue(((AnalyticsJobParameters) jc.getJobParameters()).isSkipResourceTables());
assertNotNull(((AnalyticsJobParameters) jc.getJobParameters()).getSkipTableTypes());
assertEquals(0, ((AnalyticsJobParameters) jc.getJobParameters()).getSkipTableTypes().size());
assertEquals(0, ((AnalyticsJobParameters) jc.getJobParameters()).getSkipPrograms().size());
}
use of com.fasterxml.jackson.dataformat.xml.XmlMapper in project tikxml by Tickaroo.
the class JacksonMediumXmlBenchmark method parse.
public void parse(String xml) throws Exception {
XmlMapper mapper = new XmlMapper();
Feed feed = mapper.readValue(xml, Feed.class);
System.out.println(getClass().getSimpleName() + " " + feed);
}
Aggregations