use of org.glassfish.api.admin.AdminCommandContextImpl in project Payara by payara.
the class AdminCommandContextTest method testSerialization.
@Test
public void testSerialization() throws IOException, ClassNotFoundException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
ActionReport report = new PlainTextActionReporter();
AdminCommandContext context = new AdminCommandContextImpl(null, /* logger */
report);
report.setFailureCause(new RuntimeException("Test"));
oos.writeObject(context);
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
ObjectInputStream ois = new ObjectInputStream(is);
AdminCommandContext restored = (AdminCommandContextImpl) ois.readObject();
assertEquals("failureCause", "Test", restored.getActionReport().getFailureCause().getMessage());
// context.setPayload
}
Aggregations