use of org.glassfish.api.admin.AdminCommandContext in project Payara by payara.
the class SetNotificationConfiguration method execute.
@Override
public void execute(AdminCommandContext context) {
final AdminCommandContext theContext = context;
final ActionReport actionReport = context.getActionReport();
Properties extraProperties = actionReport.getExtraProperties();
if (extraProperties == null) {
extraProperties = new Properties();
actionReport.setExtraProperties(extraProperties);
}
enableNotificationConfigureOnTarget(actionReport, theContext);
enableNotificationNotifierConfigurerOnTarget(actionReport, theContext);
}
use of org.glassfish.api.admin.AdminCommandContext 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
}
use of org.glassfish.api.admin.AdminCommandContext in project Payara by payara.
the class WrappedAdminCommandTest method getParamValueTest.
/*
* Test getParamValue from wrapped command.
*/
@Test
public void getParamValueTest() {
DummyAdminCommand dac = new DummyAdminCommand();
dac.foo = "test";
WrappedAdminCommand wrappedCommand = new WrappedAdminCommand(dac) {
@Override
public void execute(AdminCommandContext context) {
// nothing todo
}
};
assertEquals("set param value", "test", CommandSupport.getParamValue(wrappedCommand, "foo"));
// note, after resolver it must be not null
assertNull("unset param value must be null", CommandSupport.getParamValue(wrappedCommand, "foobar"));
assertNull("non existent param value must be null", CommandSupport.getParamValue(wrappedCommand, "dummy"));
}
Aggregations