use of org.apache.qpid.server.management.plugin.ManagementController in project qpid-broker-j by apache.
the class VirtualHostControllerTest method setUp.
@Before
public void setUp() {
final LegacyManagementController legacyManagementController = mock(LegacyManagementController.class);
final ManagementController nextVersionManagementController = mock(ManagementController.class);
when(legacyManagementController.getNextVersionManagementController()).thenReturn(nextVersionManagementController);
when(legacyManagementController.getVersion()).thenReturn("6.1");
_virtualHostController = new VirtualHostController(legacyManagementController, Collections.emptySet());
}
use of org.apache.qpid.server.management.plugin.ManagementController in project qpid-broker-j by apache.
the class LatestManagementControllerAdapterTest method setUp.
@Before
public void setUp() {
final HttpManagementConfiguration<?> httpManagement = mock(HttpManagementConfiguration.class);
when(httpManagement.getContextValue(Long.class, PREFERENCE_OPERTAION_TIMEOUT_CONTEXT_NAME)).thenReturn(1000L);
when(httpManagement.getModel()).thenReturn(BrokerModel.getInstance());
final ManagementController managementController = new LatestManagementController(httpManagement);
_adapter = new LatestManagementControllerAdapter(managementController);
}
use of org.apache.qpid.server.management.plugin.ManagementController in project qpid-broker-j by apache.
the class RestServlet method init.
@Override
public void init() throws ServletException {
super.init();
final ServletConfig servletConfig = getServletConfig();
final ServletContext servletContext = servletConfig.getServletContext();
final String modelVersion = servletConfig.getInitParameter("qpid.controller.version");
if (modelVersion == null) {
throw new ServletException("Controller version is not specified");
}
@SuppressWarnings("uncjecked") ManagementController controller = (ManagementController) servletContext.getAttribute("qpid.controller.chain");
do {
if (controller.getVersion().equals(modelVersion)) {
_managementController = controller;
break;
}
controller = controller.getNextVersionManagementController();
} while (controller != null);
if (_managementController == null) {
throw new ServletException("Controller is not found");
}
}
use of org.apache.qpid.server.management.plugin.ManagementController in project qpid-broker-j by apache.
the class RestServlet method doPost.
@Override
protected void doPost(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse, final ConfiguredObject<?> managedObject) throws IOException {
try {
final ManagementRequest request = new ServletManagementRequest(managedObject, httpServletRequest);
final ManagementController controller = getManagementController();
final ManagementResponse response = controller.handlePost(request);
sendResponse(request, response, httpServletRequest, httpServletResponse, controller);
} catch (ManagementException e) {
sendResponse(e, httpServletRequest, httpServletResponse);
}
}
Aggregations