Search in sources :

Example 11 with ManagementController

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());
}
Also used : LegacyManagementController(org.apache.qpid.server.management.plugin.controller.LegacyManagementController) ManagementController(org.apache.qpid.server.management.plugin.ManagementController) LegacyManagementController(org.apache.qpid.server.management.plugin.controller.LegacyManagementController) Before(org.junit.Before)

Example 12 with ManagementController

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);
}
Also used : ManagementController(org.apache.qpid.server.management.plugin.ManagementController) Before(org.junit.Before)

Example 13 with 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");
    }
}
Also used : ServletException(javax.servlet.ServletException) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext) ManagementController(org.apache.qpid.server.management.plugin.ManagementController)

Example 14 with ManagementController

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);
    }
}
Also used : ManagementRequest(org.apache.qpid.server.management.plugin.ManagementRequest) ManagementException(org.apache.qpid.server.management.plugin.ManagementException) ManagementResponse(org.apache.qpid.server.management.plugin.ManagementResponse) ManagementController(org.apache.qpid.server.management.plugin.ManagementController)

Aggregations

ManagementController (org.apache.qpid.server.management.plugin.ManagementController)14 Before (org.junit.Before)9 LegacyManagementController (org.apache.qpid.server.management.plugin.controller.LegacyManagementController)7 ManagementException (org.apache.qpid.server.management.plugin.ManagementException)4 ManagementRequest (org.apache.qpid.server.management.plugin.ManagementRequest)4 ManagementResponse (org.apache.qpid.server.management.plugin.ManagementResponse)4 ServletConfig (javax.servlet.ServletConfig)1 ServletContext (javax.servlet.ServletContext)1 ServletException (javax.servlet.ServletException)1 LegacyConfiguredObject (org.apache.qpid.server.management.plugin.controller.LegacyConfiguredObject)1 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)1