use of org.apache.camel.component.salesforce.api.utils.DateTimeConverter in project camel by apache.
the class DefaultCompositeApiClient method configureXStream.
static XStream configureXStream() {
final PureJavaReflectionProvider reflectionProvider = new PureJavaReflectionProvider(new FieldDictionary(new AnnotationFieldKeySorter()));
final XppDriver hierarchicalStreamDriver = new XppDriver(new NoNameCoder()) {
@Override
public HierarchicalStreamWriter createWriter(final Writer out) {
return new CompactWriter(out, getNameCoder());
}
};
final XStream xStream = new XStream(reflectionProvider, hierarchicalStreamDriver);
xStream.aliasSystemAttribute(null, "class");
xStream.ignoreUnknownElements();
XStreamUtils.addDefaultPermissions(xStream);
xStream.registerConverter(new DateTimeConverter());
xStream.setMarshallingStrategy(new TreeMarshallingStrategy());
xStream.processAnnotations(ADDITIONAL_TYPES);
return xStream;
}
use of org.apache.camel.component.salesforce.api.utils.DateTimeConverter in project camel by apache.
the class ApprovalRequestsTest method shouldSerializeAsXml.
@Test
public void shouldSerializeAsXml() {
final String xml = //
"<ProcessApprovalRequest>" + //
"<requests>" + //
"<actionType>Submit</actionType>" + //
"<contextActorId>005D00000015rZy</contextActorId>" + //
"<contextId>001D000000I8mIm</contextId>" + //
"<comments>this is a test 1</comments>" + //
"<nextApproverIds>005D00000015rY9</nextApproverIds>" + //
"<processDefinitionNameOrId>PTO_Request_Process</processDefinitionNameOrId>" + //
"<skipEntryCriteria>true</skipEntryCriteria>" + //
"</requests>" + //
"<requests>" + //
"<actionType>Submit</actionType>" + //
"<contextActorId>005D00000015rZy</contextActorId>" + //
"<contextId>001D000000I8dIm</contextId>" + //
"<comments>this is a test 2</comments>" + //
"<nextApproverIds>005D00000015xY9</nextApproverIds>" + //
"<processDefinitionNameOrId>PTO_Request_Process</processDefinitionNameOrId>" + //
"<skipEntryCriteria>true</skipEntryCriteria>" + //
"</requests>" + "</ProcessApprovalRequest>";
final XStream xStream = new XStream(new XppDriver(new NoNameCoder()) {
@Override
public HierarchicalStreamWriter createWriter(final Writer out) {
return new CompactWriter(out, getNameCoder());
}
});
xStream.ignoreUnknownElements();
XStreamUtils.addDefaultPermissions(xStream);
xStream.registerConverter(new DateTimeConverter());
xStream.processAnnotations(ApprovalRequests.class);
final String serialized = xStream.toXML(requests);
assertEquals("Approval requests should serialize as XML", xml, serialized);
}
Aggregations