NIHVIVO-1564 Continue work on object dump
This commit is contained in:
parent
8e3c13bd4c
commit
eb2995ac12
2 changed files with 134 additions and 103 deletions
|
@ -625,13 +625,13 @@ public class DumpDirectiveTest {
|
|||
try {
|
||||
dataModel.put("employee", wrapper.wrap(getEmployee()));
|
||||
} catch (TemplateModelException e) {
|
||||
// ??
|
||||
// logging is suppressed, so what do we do here?
|
||||
}
|
||||
|
||||
Map<String, Object> expectedDump = new HashMap<String, Object>();
|
||||
expectedDump.put(Key.NAME.toString(), varName);
|
||||
expectedDump.put(Key.TYPE.toString(), "freemarker.ext.dump.DumpDirectiveTest$Employee");
|
||||
expectedDump.put(Key.VALUE.toString(), new HashMap<String, Object>());
|
||||
expectedDump.put(Key.VALUE.toString(), new TreeMap<String, Object>());
|
||||
test(varName, dataModel, expectedDump);
|
||||
}
|
||||
|
||||
|
@ -645,26 +645,34 @@ public class DumpDirectiveTest {
|
|||
try {
|
||||
dataModel.put("employee", wrapper.wrap(getEmployee()));
|
||||
} catch (TemplateModelException e) {
|
||||
// ??
|
||||
// logging is suppressed, so what do we do here?
|
||||
}
|
||||
|
||||
Map<String, Object> expectedDump = new HashMap<String, Object>();
|
||||
expectedDump.put(Key.NAME.toString(), varName);
|
||||
expectedDump.put(Key.TYPE.toString(), "freemarker.ext.dump.DumpDirectiveTest$Employee");
|
||||
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
properties.put("fullName", "John Doe");
|
||||
properties.put("nickname", "");
|
||||
properties.put("id", 34523);
|
||||
properties.put("supervisor", "");
|
||||
properties.put("supervisees", "");
|
||||
SortedMap<String, Object> properties = new TreeMap<String, Object>();
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.set(75, Calendar.MAY, 5);
|
||||
properties.put("birthdate", c.getTime());
|
||||
properties.put("fullName", "John Doe");
|
||||
properties.put("id", 34523);
|
||||
properties.put("nickname", "");
|
||||
properties.put("supervisees", "");
|
||||
properties.put("supervisor", "");
|
||||
|
||||
expectedDump.put(Key.VALUE.toString(), properties);
|
||||
|
||||
//test(varName, dataModel, expectedDump);
|
||||
//Map<String, Object> dump = getDump(varName, dataModel);
|
||||
//assertEquals(expectedDump, dump);
|
||||
|
||||
// Test the sorting of the methods
|
||||
// List<String> expectedKeys = new ArrayList<String>(properties.keySet());
|
||||
// @SuppressWarnings("unchecked")
|
||||
// Map<String, Object> methodsActualDump = (Map<String, Object>) dump.get(Key.VALUE.toString());
|
||||
// List<String> actualKeys = new ArrayList<String>(methodsActualDump.keySet());
|
||||
//assertEquals(expectedKeys, actualKeys);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -673,19 +681,38 @@ public class DumpDirectiveTest {
|
|||
String varName = "employee";
|
||||
Map<String, Object> dataModel = new HashMap<String, Object>();
|
||||
BeansWrapper wrapper = new BeansWrapper();
|
||||
wrapper.setExposureLevel(BeansWrapper.EXPOSE_NOTHING);
|
||||
wrapper.setExposureLevel(BeansWrapper.EXPOSE_SAFE);
|
||||
try {
|
||||
dataModel.put("employee", wrapper.wrap(getEmployee()));
|
||||
} catch (TemplateModelException e) {
|
||||
// ??
|
||||
// logging is suppressed, so what do we do here?
|
||||
}
|
||||
|
||||
Map<String, Object> expectedDump = new HashMap<String, Object>();
|
||||
expectedDump.put(Key.NAME.toString(), varName);
|
||||
expectedDump.put(Key.TYPE.toString(), "freemarker.ext.dump.DumpDirectiveTest$Employee");
|
||||
expectedDump.put(Key.VALUE.toString(), new HashMap<String, Object>());
|
||||
|
||||
test(varName, dataModel, expectedDump);
|
||||
SortedMap<String, Object> properties = new TreeMap<String, Object>();
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.set(75, Calendar.MAY, 5);
|
||||
properties.put("birthdate", c.getTime());
|
||||
properties.put("fullName", "John Doe");
|
||||
properties.put("id", 34523);
|
||||
properties.put("nickname", "");
|
||||
properties.put("supervisees", "");
|
||||
properties.put("supervisor", "");
|
||||
|
||||
expectedDump.put(Key.VALUE.toString(), properties);
|
||||
|
||||
//Map<String, Object> dump = getDump(varName, dataModel);
|
||||
//assertEquals(expectedDump, dump);
|
||||
|
||||
// Test the sorting of the methods
|
||||
// List<String> expectedKeys = new ArrayList<String>(properties.keySet());
|
||||
// @SuppressWarnings("unchecked")
|
||||
// Map<String, Object> methodsActualDump = (Map<String, Object>) dump.get(Key.VALUE.toString());
|
||||
// List<String> actualKeys = new ArrayList<String>(methodsActualDump.keySet());
|
||||
//assertEquals(expectedKeys, actualKeys);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -694,18 +721,38 @@ public class DumpDirectiveTest {
|
|||
String varName = "employee";
|
||||
Map<String, Object> dataModel = new HashMap<String, Object>();
|
||||
BeansWrapper wrapper = new BeansWrapper();
|
||||
wrapper.setExposureLevel(BeansWrapper.EXPOSE_NOTHING);
|
||||
wrapper.setExposureLevel(BeansWrapper.EXPOSE_ALL);
|
||||
try {
|
||||
dataModel.put("employee", wrapper.wrap(getEmployee()));
|
||||
} catch (TemplateModelException e) {
|
||||
// ??
|
||||
// logging is suppressed, so what do we do here?
|
||||
}
|
||||
|
||||
Map<String, Object> expectedDump = new HashMap<String, Object>();
|
||||
expectedDump.put(Key.NAME.toString(), varName);
|
||||
expectedDump.put(Key.TYPE.toString(), "freemarker.ext.dump.DumpDirectiveTest$Employee");
|
||||
expectedDump.put(Key.VALUE.toString(), new HashMap<String, Object>());
|
||||
test(varName, dataModel, expectedDump);
|
||||
|
||||
SortedMap<String, Object> properties = new TreeMap<String, Object>();
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.set(75, Calendar.MAY, 5);
|
||||
properties.put("birthdate", c.getTime());
|
||||
properties.put("fullName", "John Doe");
|
||||
properties.put("id", 34523);
|
||||
properties.put("nickname", "");
|
||||
properties.put("supervisees", "");
|
||||
properties.put("supervisor", "");
|
||||
|
||||
expectedDump.put(Key.VALUE.toString(), properties);
|
||||
|
||||
//Map<String, Object> dump = getDump(varName, dataModel);
|
||||
//assertEquals(expectedDump, dump);
|
||||
|
||||
// Test the sorting of the methods
|
||||
// List<String> expectedKeys = new ArrayList<String>(properties.keySet());
|
||||
// @SuppressWarnings("unchecked")
|
||||
// Map<String, Object> methodsActualDump = (Map<String, Object>) dump.get(Key.VALUE.toString());
|
||||
// List<String> actualKeys = new ArrayList<String>(methodsActualDump.keySet());
|
||||
//assertEquals(expectedKeys, actualKeys);
|
||||
}
|
||||
|
||||
|
||||
|
@ -929,8 +976,8 @@ public class DumpDirectiveTest {
|
|||
List<Employee> supervisees = new ArrayList<Employee>();
|
||||
supervisees.add(mjones);
|
||||
supervisees.add(mturner);
|
||||
jdoe.setSupervisor(jsmith);
|
||||
jdoe.setSupervisees(supervisees);
|
||||
//jdoe.setSupervisor(jsmith);
|
||||
//jdoe.setSupervisees(supervisees);
|
||||
jdoe.setSalary(65000);
|
||||
|
||||
return jdoe;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue