/** * Output the model to xml * * @param model the model to marshall * @return the xml */ String outputModel(ModelNode model) throws Exception { StringConfigurationPersister persister = new StringConfigurationPersister(Collections.emptyList(), testParser, true); // Use ProcessType.HOST_CONTROLLER for this ExtensionRegistry so we don't need to provide // a PathManager via the ExtensionContext. All we need the Extension to do here is register the xml writers ExtensionRegistry outputExtensionRegistry = new ExtensionRegistry(ProcessType.HOST_CONTROLLER, new RunningModeControl(RunningMode.NORMAL), null, null, null, RuntimeHostControllerInfoAccessor.SERVER); outputExtensionRegistry.setWriterRegistry(persister); Extension extension = mainExtension.getClass().newInstance(); extension.initialize(outputExtensionRegistry.getExtensionContext("Test", MOCK_RESOURCE_REG, ExtensionRegistryType.SLAVE)); ConfigurationPersister.PersistenceResource resource = persister.store(model, Collections.emptySet()); resource.commit(); return persister.getMarshalled(); }
StringConfigurationPersister persister = new StringConfigurationPersister(bootOperations, testParser, true);
/** * Reads the persisted subsystem xml * * @return the xml */ @Override public String getPersistedSubsystemXml() { return persister.getMarshalled(); }
@Override protected boolean boot(List<ModelNode> bootOperations, boolean rollbackOnRuntimeFailure) throws ConfigurationPersistenceException { try { preBoot(bootOperations, rollbackOnRuntimeFailure); // See what we need to validate, but defer doing it to after super.boot to allow // initModel to run first and given tests a chance to set things up List<ModelNode> validationList = new ArrayList<>(); for (ModelNode op : bootOperations) { ModelNode toValidate = validateOpsFilter.adjustForValidation(op.clone()); if (toValidate != null) { validationList.add(toValidate); } } bootSuccess = super.boot(persister.getBootOperations(), rollbackOnRuntimeFailure); // Ok, now we can validate OperationValidator validator = new OperationValidator(rootRegistration); for (ModelNode op : validationList) { validator.validateOperation(op); } return bootSuccess; } catch (Exception e) { error = e; } catch (Throwable t) { error = new Exception(t); } finally { postBoot(); } return false; }
StringConfigurationPersister persister = new StringConfigurationPersister(bootOperations, testParser, true);
/** * Output the model to xml * * @param model the model to marshall * @return the xml */ String outputModel(ModelNode model) throws Exception { StringConfigurationPersister persister = new StringConfigurationPersister(Collections.emptyList(), testParser, true); // Use ProcessType.HOST_CONTROLLER for this ExtensionRegistry so we don't need to provide // a PathManager via the ExtensionContext. All we need the Extension to do here is register the xml writers ExtensionRegistry outputExtensionRegistry = new ExtensionRegistry(ProcessType.HOST_CONTROLLER, new RunningModeControl(RunningMode.NORMAL), null, null, null, RuntimeHostControllerInfoAccessor.SERVER); outputExtensionRegistry.setWriterRegistry(persister); Extension extension = mainExtension.getClass().newInstance(); extension.initialize(outputExtensionRegistry.getExtensionContext("Test", MOCK_RESOURCE_REG, ExtensionRegistryType.SLAVE)); ConfigurationPersister.PersistenceResource resource = persister.store(model, Collections.emptySet()); resource.commit(); return persister.getMarshalled(); }
StringConfigurationPersister persister = new StringConfigurationPersister(allOps, testParser, persistXml); controllerExtensionRegistry.setWriterRegistry(persister); controllerExtensionRegistry.setPathManager(pathManager);
/** * Output the model to xml * * @param model the model to marshall * @return the xml */ String outputModel(ModelNode model) throws Exception { StringConfigurationPersister persister = new StringConfigurationPersister(Collections.<ModelNode>emptyList(), testParser, true); // Use ProcessType.HOST_CONTROLLER for this ExtensionRegistry so we don't need to provide // a PathManager via the ExtensionContext. All we need the Extension to do here is register the xml writers ExtensionRegistry outputExtensionRegistry = new ExtensionRegistry(ProcessType.HOST_CONTROLLER, new RunningModeControl(RunningMode.NORMAL), null, null); outputExtensionRegistry.setSubsystemParentResourceRegistrations(MOCK_RESOURCE_REG, MOCK_RESOURCE_REG); outputExtensionRegistry.setWriterRegistry(persister); Extension extension = mainExtension.getClass().newInstance(); extension.initialize(outputExtensionRegistry.getExtensionContext("Test", false)); ConfigurationPersister.PersistenceResource resource = persister.store(model, Collections.<PathAddress>emptySet()); resource.commit(); return persister.getMarshalled(); }
StringConfigurationPersister persister = new StringConfigurationPersister(allOps, testParser, persistXml); controllerExtensionRegistry.setWriterRegistry(persister); controllerExtensionRegistry.setPathManager(pathManager);
StringConfigurationPersister persister = new StringConfigurationPersister(allOps, testParser, persistXml); controllerExtensionRegistry.setWriterRegistry(persister); controllerExtensionRegistry.setPathManager(pathManager);