si.setComments("xxxCommentsxxx");
si.setKeywords("xxxKeyWordsxxx");
si.setSubject("xxxSubjectxxx");
// Custom Properties (in DocumentSummaryInformation
CustomProperties customProperties = dsi.getCustomProperties();
if (customProperties == null) {
customProperties = new CustomProperties();
}
/* Insert some custom properties into the container. */
customProperties.put("Key1", "Value1");
customProperties.put("Schl\u00fcssel2", "Wert2");
customProperties.put("Sample Integer", new Integer(12345));
customProperties.put("Sample Boolean", Boolean.TRUE);
Date date = new Date();
customProperties.put("Sample Date", date);
customProperties.put("Sample Double", new Double(-1.0001));
customProperties.put("Sample Negative Integer", new Integer(-100000));
dsi.setCustomProperties(customProperties);
// start reading
closeAndReOpen();
// testing
assertNotNull(dsi);
assertNotNull(si);
assertEquals("Category", "xxxCategoryxxx", dsi.getCategory());
assertEquals("Company", "xxxCompanyxxx", dsi.getCompany());
assertEquals("Manager", "xxxManagerxxx", dsi.getManager());
assertEquals("", "xxxAuthorxxx", si.getAuthor());
assertEquals("", "xxxTitlexxx", si.getTitle());
assertEquals("", "xxxCommentsxxx", si.getComments());
assertEquals("", "xxxKeyWordsxxx", si.getKeywords());
assertEquals("", "xxxSubjectxxx", si.getSubject());
/*
* Read the custom properties. If there are no custom properties yet,
* the application has to create a new CustomProperties object. It will
* serve as a container for custom properties.
*/
customProperties = dsi.getCustomProperties();
if (customProperties == null) {
fail();
}
/* Insert some custom properties into the container. */
String a1 = (String) customProperties.get("Key1");
assertEquals("Key1", "Value1", a1);
String a2 = (String) customProperties.get("Schl\u00fcssel2");
assertEquals("Schl\u00fcssel2", "Wert2", a2);
Integer a3 = (Integer) customProperties.get("Sample Integer");
assertEquals("Sample Number", new Integer(12345), a3);
Boolean a4 = (Boolean) customProperties.get("Sample Boolean");
assertEquals("Sample Boolean", Boolean.TRUE, a4);
Date a5 = (Date) customProperties.get("Sample Date");
assertEquals("Custom Date:", date, a5);
Double a6 = (Double) customProperties.get("Sample Double");
assertEquals("Custom Float", new Double(-1.0001), a6);
Integer a7 = (Integer) customProperties.get("Sample Negative Integer");
assertEquals("Neg", new Integer(-100000), a7);
}