/** {@inheritDoc} */
 @Override
 protected String installExtension(String module, OperationContext context) {
   try {
     for (Extension extension :
         Module.loadServiceFromCurrent(ModuleIdentifier.fromString(module), Extension.class)) {
       extension.initialize(extensionContext);
     }
     return null;
   } catch (ModuleLoadException e) {
     return e.getLocalizedMessage();
   }
 }
  /**
   * Output the model to xml
   *
   * @param additionalParsers additional initialization that should be done to the parsers before
   *     initializing our extension. These parsers will only be initialized the first time this
   *     method or {@link #parse(AdditionalParsers, String)} is called from within a test
   * @param model the model to marshall
   * @return the xml
   */
  protected String outputModel(AdditionalParsers additionalParsers, ModelNode model)
      throws Exception {
    addAdditionalParsers(additionalParsers);
    StringConfigurationPersister persister =
        new StringConfigurationPersister(Collections.<ModelNode>emptyList(), testParser);

    Extension extension = mainExtension.getClass().newInstance();
    extension.initialize(new ExtensionContextImpl(MOCK_RESOURCE_REG, MOCK_RESOURCE_REG, persister));

    ConfigurationPersister.PersistenceResource resource =
        persister.store(model, Collections.<PathAddress>emptySet());
    resource.commit();
    return persister.marshalled;
  }
    @Override
    protected void initModel(
        Resource rootResource, ManagementResourceRegistration rootRegistration) {
      this.rootRegistration = rootRegistration;
      rootResource.getModel().get(SUBSYSTEM);
      rootRegistration.registerOperationHandler(
          READ_RESOURCE_OPERATION,
          GlobalOperationHandlers.READ_RESOURCE,
          CommonProviders.READ_RESOURCE_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          READ_ATTRIBUTE_OPERATION,
          GlobalOperationHandlers.READ_ATTRIBUTE,
          CommonProviders.READ_ATTRIBUTE_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          READ_RESOURCE_DESCRIPTION_OPERATION,
          GlobalOperationHandlers.READ_RESOURCE_DESCRIPTION,
          CommonProviders.READ_RESOURCE_DESCRIPTION_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          READ_CHILDREN_NAMES_OPERATION,
          GlobalOperationHandlers.READ_CHILDREN_NAMES,
          CommonProviders.READ_CHILDREN_NAMES_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          READ_CHILDREN_TYPES_OPERATION,
          GlobalOperationHandlers.READ_CHILDREN_TYPES,
          CommonProviders.READ_CHILDREN_TYPES_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          READ_CHILDREN_RESOURCES_OPERATION,
          GlobalOperationHandlers.READ_CHILDREN_RESOURCES,
          CommonProviders.READ_CHILDREN_RESOURCES_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          READ_OPERATION_NAMES_OPERATION,
          GlobalOperationHandlers.READ_OPERATION_NAMES,
          CommonProviders.READ_OPERATION_NAMES_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          READ_OPERATION_DESCRIPTION_OPERATION,
          GlobalOperationHandlers.READ_OPERATION_DESCRIPTION,
          CommonProviders.READ_OPERATION_PROVIDER,
          true);
      rootRegistration.registerOperationHandler(
          WRITE_ATTRIBUTE_OPERATION,
          GlobalOperationHandlers.WRITE_ATTRIBUTE,
          CommonProviders.WRITE_ATTRIBUTE_PROVIDER,
          true);

      controllerInitializer.initializeModel(rootResource, rootRegistration);

      ExtensionContext context = new ExtensionContextImpl(rootRegistration, null, persister);
      additionalInit.initializeExtraSubystemsAndModel(context, rootResource, rootRegistration);
      mainExtension.initialize(context);
    }
  @Before
  public void initializeParser() throws Exception {
    // Initialize the parser
    XMLMapper mapper = XMLMapper.Factory.create();
    testParser = new TestParser();
    mapper.registerRootElement(new QName(TEST_NAMESPACE, "test"), testParser);
    parsingContext = new ExtensionParsingContextImpl(mapper);
    mainExtension.initializeParsers(parsingContext);
    addedExtraParsers = false;

    stack.set(new Stack<String>());
  }