Java Code Examples for org.jboss.as.controller.RunningMode#NORMAL
The following examples show how to use
org.jboss.as.controller.RunningMode#NORMAL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubsystemTestDelegate.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * 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(); }
Example 2
Source File: InterfaceManagementUnitTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
ModelControllerService(final ControlledProcessState processState, final StringConfigurationPersister persister, final ServerDelegatingResourceDefinition rootResourceDefinition) { super(ProcessType.EMBEDDED_SERVER, new RunningModeControl(RunningMode.ADMIN_ONLY), persister, processState, rootResourceDefinition, null, ExpressionResolver.TEST_RESOLVER, AuditLogger.NO_OP_LOGGER, new DelegatingConfigurableAuthorizer(), new ManagementSecurityIdentitySupplier(), new CapabilityRegistry(true)); this.persister = persister; this.processState = processState; this.rootResourceDefinition = rootResourceDefinition; Properties properties = new Properties(); properties.put("jboss.home.dir", System.getProperty("basedir", ".") + File.separatorChar + "target"); final String hostControllerName = "hostControllerName"; // Host Controller name may not be null when in a managed domain environment = new ServerEnvironment(hostControllerName, properties, new HashMap<String, String>(), null, null, ServerEnvironment.LaunchType.DOMAIN, null, ProductConfig.fromFilesystemSlot(Module.getBootModuleLoader(), ".", properties), false); extensionRegistry = new ExtensionRegistry(ProcessType.STANDALONE_SERVER, new RunningModeControl(RunningMode.NORMAL), null, null, null, RuntimeHostControllerInfoAccessor.SERVER); capabilityRegistry = new CapabilityRegistry(processType.isServer()); }
Example 3
Source File: LoggingTestEnvironment.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void initializeExtraSubystemsAndModel(final ExtensionRegistry extensionRegistry, final Resource rootResource, final ManagementResourceRegistration rootRegistration, final RuntimeCapabilityRegistry capabilityRegistry) { super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); if (runningMode == RunningMode.NORMAL) { registerCapabilities(capabilityRegistry, RuntimeCapability.Builder.of("org.wildfly.network.outbound-socket-binding", true, OutboundSocketBinding.class).build() ); } }
Example 4
Source File: IOSubsystem11TestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected AdditionalInitialization createAdditionalInitialization() { return new AdditionalInitialization() { @Override protected RunningMode getRunningMode() { return RunningMode.NORMAL; } }; }
Example 5
Source File: IOSubsystem20TestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected AdditionalInitialization createAdditionalInitialization() { return new AdditionalInitialization() { @Override protected RunningMode getRunningMode() { return RunningMode.NORMAL; } }; }
Example 6
Source File: TestModelControllerService.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected TestModelControllerService(final ProcessType processType, final ConfigurationPersister configurationPersister, final ControlledProcessState processState, final ResourceDefinition rootResourceDefinition, final ManagedAuditLogger auditLogger, final AbstractControllerTestBase.DelegatingResourceDefinitionInitializer initializer, final CapabilityRegistry capabilityRegistry) { super(processType, new RunningModeControl(RunningMode.NORMAL), configurationPersister, processState, rootResourceDefinition, null, ExpressionResolver.TEST_RESOLVER, auditLogger, new DelegatingConfigurableAuthorizer(), new ManagementSecurityIdentitySupplier(), capabilityRegistry); this.processState = processState; internalExecutor = new InternalExecutor(); this.initializer = initializer; }
Example 7
Source File: ManagedServerBootCmdFactoryTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static HostControllerEnvironment getTestHostEnvironment() throws UnknownHostException { Map<String, String> hostSystemProperties = new HashMap<>(); hostSystemProperties.put("jboss.server.log.dir", "/tmp/"); hostSystemProperties.put("jboss.domain.log.dir", "/tmp/"); hostSystemProperties.put("jboss.server.temp.dir", "/tmp/"); hostSystemProperties.put(HOME_DIR, homeDir.toAbsolutePath().toString()); return new HostControllerEnvironment( hostSystemProperties, false, "/opt/wildfly/modules", InetAddress.getLocalHost(), 8080, InetAddress.getLocalHost(), 9990, null, null, null, null, null, RunningMode.NORMAL, true, true, null); }
Example 8
Source File: HostControllerEnvironmentTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testUUIDLifeCycle() throws IOException { Map<String, String> hostProperties = new HashMap(); Path domainDir = homeDir.resolve("domain"); Files.createDirectories(domainDir.resolve("configuration")); Path uuidPath = domainDir.resolve("data").resolve("kernel").resolve("process-uuid"); assertThat(Files.notExists(uuidPath), is(true)); hostProperties.put(HOME_DIR, homeDir.toAbsolutePath().toString()); //Check creation on startup HostControllerEnvironment hcEnvironment = new HostControllerEnvironment(hostProperties, false, "", InetAddress.getLocalHost(), 8080, InetAddress.getLocalHost(), 9990, null, null, null, null, null, RunningMode.NORMAL, true, true, null); assertThat(Files.exists(uuidPath), is(true)); List<String> uuids = Files.readAllLines(uuidPath); assertThat(uuids, is(not(nullValue()))); assertThat(uuids.size(), is(1)); String uuid = uuids.get(0); //Check nothing happens on startup if file is already there hcEnvironment = new HostControllerEnvironment(hostProperties, false, "", InetAddress.getLocalHost(), 8080, InetAddress.getLocalHost(), 9990, null, null, null, null, null, RunningMode.NORMAL, true, true, null); assertThat(Files.exists(uuidPath), is(true)); uuids = Files.readAllLines(uuidPath); assertThat(uuids, is(not(nullValue()))); assertThat(uuids.size(), is(1)); assertThat(uuids.get(0), is(uuid)); //Check re-creation on startup Files.delete(uuidPath); assertThat(Files.notExists(uuidPath), is(true)); hcEnvironment = new HostControllerEnvironment(hostProperties, false, "", InetAddress.getLocalHost(), 8080, InetAddress.getLocalHost(), 9990, null, null, null, null, null, RunningMode.NORMAL, true, true, null); assertThat(Files.exists(uuidPath), is(true)); uuids = Files.readAllLines(uuidPath); assertThat(uuids, is(not(nullValue()))); assertThat(uuids.size(), is(1)); assertThat(uuids.get(0), is(not(uuid))); Files.delete(uuidPath); }
Example 9
Source File: ServerEnvironmentTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testUUIDLifeCycle() throws IOException { Properties props = new Properties(); Path standaloneDir = homeDir.resolve("standalone"); Files.createDirectories(standaloneDir.resolve("configuration")); Files.createFile(standaloneDir.resolve("configuration").resolve("standalone.xml")); Path uuidPath = standaloneDir.resolve("data").resolve("kernel").resolve("process-uuid"); assertThat(Files.notExists(uuidPath), is(true)); props.put(HOME_DIR, homeDir.toAbsolutePath().toString()); //Check creation on startup ServerEnvironment serverEnvironment = new ServerEnvironment(null, props, System.getenv(), "standalone.xml", ConfigurationFile.InteractionPolicy.READ_ONLY, ServerEnvironment.LaunchType.STANDALONE, RunningMode.NORMAL, null, false); assertThat(Files.exists(uuidPath), is(true)); List<String> uuids = Files.readAllLines(uuidPath); assertThat(uuids, is(not(nullValue()))); assertThat(uuids.size(), is(1)); String uuid = uuids.get(0); //Check nothing happens on startup if file is already there serverEnvironment = new ServerEnvironment(null, props, System.getenv(), "standalone.xml", ConfigurationFile.InteractionPolicy.READ_ONLY, ServerEnvironment.LaunchType.STANDALONE, RunningMode.NORMAL, null, false); assertThat(Files.exists(uuidPath), is(true)); uuids = Files.readAllLines(uuidPath); assertThat(uuids, is(not(nullValue()))); assertThat(uuids.size(), is(1)); assertThat(uuids.get(0), is(uuid)); //Check re-creation on startup Files.delete(uuidPath); assertThat(Files.notExists(uuidPath), is(true)); serverEnvironment = new ServerEnvironment(null, props, System.getenv(), "standalone.xml", ConfigurationFile.InteractionPolicy.READ_ONLY, ServerEnvironment.LaunchType.STANDALONE, RunningMode.NORMAL, null, false); assertThat(Files.exists(uuidPath), is(true)); uuids = Files.readAllLines(uuidPath); assertThat(uuids, is(not(nullValue()))); assertThat(uuids.size(), is(1)); assertThat(uuids.get(0), is(not(uuid))); Files.delete(uuidPath); }
Example 10
Source File: LoggingTestEnvironment.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void setupController(final ControllerInitializer controllerInitializer) { super.setupController(controllerInitializer); System.setProperty("jboss.server.log.dir", logDir.toAbsolutePath().toString()); System.setProperty("jboss.server.config.dir", configDir.toAbsolutePath().toString()); controllerInitializer.addPath("jboss.server.log.dir", logDir.toAbsolutePath().toString(), null); controllerInitializer.addPath("jboss.server.config.dir", configDir.toAbsolutePath().toString(), null); if (runningMode == RunningMode.NORMAL) { controllerInitializer.addRemoteOutboundSocketBinding("log-server", "localhost", 10514); } }
Example 11
Source File: TestModelControllerService.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected TestModelControllerService(final ProcessType processType, final ConfigurationPersister configurationPersister, final ControlledProcessState processState, final ResourceDefinition rootResourceDefinition, final ManagedAuditLogger auditLogger, final DelegatingConfigurableAuthorizer authorizer) { super(processType, new RunningModeControl(RunningMode.NORMAL), configurationPersister, processState, rootResourceDefinition, null, ExpressionResolver.TEST_RESOLVER, auditLogger, authorizer == null ? new DelegatingConfigurableAuthorizer() : authorizer, new ManagementSecurityIdentitySupplier(), new CapabilityRegistry(true)); this.processState = processState; this.processType = processType; }
Example 12
Source File: IOSubsystemTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected AdditionalInitialization createAdditionalInitialization() { return new AdditionalInitialization() { @Override protected RunningMode getRunningMode() { return RunningMode.NORMAL; } }; }
Example 13
Source File: TestModelControllerService.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
protected TestModelControllerService(final ProcessType processType, final ConfigurationPersister configurationPersister, final ControlledProcessState processState, final ResourceDefinition rootResourceDefinition, final ManagedAuditLogger auditLogger) { super(processType, new RunningModeControl(RunningMode.NORMAL), configurationPersister, processState, rootResourceDefinition, null, ExpressionResolver.TEST_RESOLVER, auditLogger, new DelegatingConfigurableAuthorizer(), new ManagementSecurityIdentitySupplier(), new CapabilityRegistry(true)); this.processState = processState; }
Example 14
Source File: JmxFacadeRbacEnabledTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
protected void initModel(ManagementModel managementModel) { this.rootResource = managementModel.getRootResource(); this.rootRegistration = managementModel.getRootResourceRegistration(); PathManagerService pathManagerService = new PathManagerService() { }; GlobalOperationHandlers.registerGlobalOperations(rootRegistration, processType); rootRegistration.registerOperationHandler(CompositeOperationHandler.DEFINITION, CompositeOperationHandler.INSTANCE); GlobalNotifications.registerGlobalNotifications(rootRegistration, processType); StabilityMonitor monitor = new StabilityMonitor(); getContainer().addService(AbstractControllerService.PATH_MANAGER_CAPABILITY.getCapabilityServiceName(), pathManagerService) .addMonitor(monitor) .install(); try { monitor.awaitStability(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } rootRegistration.registerSubModel(PathResourceDefinition.createSpecified(pathManagerService)); rootRegistration.registerSubModel(CoreManagementResourceDefinition.forStandaloneServer(getAuthorizer(), getSecurityIdentitySupplier(), getAuditLogger(), pathManagerService, new EnvironmentNameReader() { public boolean isServer() { return true; } public String getServerName() { return "Test"; } public String getHostName() { return null; } public String getProductName() { return null; } }, null, new ResourceDefinition[0])); pathManagerService.addPathManagerResources(rootResource); ExtensionRegistry extensionRegistry = new ExtensionRegistry(ProcessType.STANDALONE_SERVER, new RunningModeControl(RunningMode.NORMAL), AuditLogger.NO_OP_LOGGER, getAuthorizer(), getSecurityIdentitySupplier(), RuntimeHostControllerInfoAccessor.SERVER); extensionRegistry.setPathManager(pathManagerService); extensionRegistry.setWriterRegistry(new NullConfigurationPersister()); JMXExtension extension = new JMXExtension(); extension.initialize(extensionRegistry.getExtensionContext("org.jboss.as.jmx", rootRegistration, ExtensionRegistryType.SLAVE)); Resource coreManagementResource = Resource.Factory.create(); rootResource.registerChild(CoreManagementResourceDefinition.PATH_ELEMENT, coreManagementResource); Resource accessAuthorizationResource = Resource.Factory.create(); accessAuthorizationResource.getModel().get(AccessAuthorizationResourceDefinition.PROVIDER.getName()).set(AccessAuthorizationResourceDefinition.Provider.SIMPLE.toString()); coreManagementResource.registerChild(AccessAuthorizationResourceDefinition.PATH_ELEMENT, accessAuthorizationResource); }
Example 15
Source File: AbstractControllerTestBase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private static HostControllerEnvironment createHostControllerEnvironment(String hostName) { //Copied from core-model-test try { Map<String, String> props = new HashMap<String, String>(); File home = new File("target/wildfly"); delete(home); home.mkdir(); props.put(HostControllerEnvironment.HOME_DIR, home.getAbsolutePath()); File domain = new File(home, "domain"); domain.mkdir(); props.put(HostControllerEnvironment.DOMAIN_BASE_DIR, domain.getAbsolutePath()); File configuration = new File(domain, "configuration"); configuration.mkdir(); props.put(HostControllerEnvironment.DOMAIN_CONFIG_DIR, configuration.getAbsolutePath()); props.put(HostControllerEnvironment.HOST_NAME, hostName); boolean isRestart = false; String modulePath = ""; InetAddress processControllerAddress = InetAddress.getLocalHost(); Integer processControllerPort = 9999; InetAddress hostControllerAddress = InetAddress.getLocalHost(); Integer hostControllerPort = 1234; String defaultJVM = null; String domainConfig = null; String initialDomainConfig = null; String hostConfig = null; String initialHostConfig = null; RunningMode initialRunningMode = RunningMode.NORMAL; boolean backupDomainFiles = false; boolean useCachedDc = false; ProductConfig productConfig = ProductConfig.fromFilesystemSlot(null, "", props); return new HostControllerEnvironment(props, isRestart, modulePath, processControllerAddress, processControllerPort, hostControllerAddress, hostControllerPort, defaultJVM, domainConfig, initialDomainConfig, hostConfig, initialHostConfig, initialRunningMode, backupDomainFiles, useCachedDc, productConfig); } catch (UnknownHostException e) { // AutoGenerated throw new RuntimeException(e); } }
Example 16
Source File: PlatformMBeanTestModelControllerService.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
/** * Construct a new instance. * */ protected PlatformMBeanTestModelControllerService() { super(ProcessType.EMBEDDED_SERVER, new RunningModeControl(RunningMode.NORMAL), new NullConfigurationPersister(), new ControlledProcessState(true), ResourceBuilder.Factory.create(PathElement.pathElement("root"),new NonResolvingResourceDescriptionResolver()).build(), null, ExpressionResolver.TEST_RESOLVER, AuditLogger.NO_OP_LOGGER, new DelegatingConfigurableAuthorizer(), new ManagementSecurityIdentitySupplier(), new CapabilityRegistry(true)); }
Example 17
Source File: ServerStartTask.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public AsyncFuture<ServiceContainer> run(final List<ServiceActivator> runServices) { final Bootstrap bootstrap = Bootstrap.Factory.newInstance(); final ProductConfig productConfig = ProductConfig.fromFilesystemSlot(Module.getBootModuleLoader(), home, properties); // Create server environment on the server, so that the system properties are getting initialized on the right side final ServerEnvironment providedEnvironment = new ServerEnvironment(hostControllerName, properties, WildFlySecurityManager.getSystemEnvironmentPrivileged(), null, null, ServerEnvironment.LaunchType.DOMAIN, RunningMode.NORMAL, productConfig, Module.getStartTime(), suspend, null, null, null); DomainServerCommunicationServices.updateOperationID(initialOperationID); // TODO perhaps have ConfigurationPersisterFactory as a Service final List<ServiceActivator> services = new ArrayList<ServiceActivator>(startServices); final ServerBootOperationsService service = new ServerBootOperationsService(); // ModelController.boot() will block on this future in order to get the boot updates. final Future<ModelNode> bootOperations = service.getFutureResult(); final ServiceActivator activator = new ServiceActivator() { @Override public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { final ServiceTarget target = serviceActivatorContext.getServiceTarget(); final ServiceBuilder sb = target.addService(ServiceName.JBOSS.append("server-boot-operations"), service); sb.requires(Services.JBOSS_AS); sb.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getServerController()); sb.addDependency(HostControllerConnectionService.SERVICE_NAME, HostControllerClient.class, service.getClientInjector()); sb.addDependency(Services.JBOSS_SERVER_EXECUTOR, Executor.class, service.getExecutorInjector()); sb.install(); } }; services.add(activator); final Bootstrap.Configuration configuration = new Bootstrap.Configuration(providedEnvironment); final ExtensionRegistry extensionRegistry = configuration.getExtensionRegistry(); final Bootstrap.ConfigurationPersisterFactory configurationPersisterFactory = new Bootstrap.ConfigurationPersisterFactory() { @Override public ExtensibleConfigurationPersister createConfigurationPersister(ServerEnvironment serverEnvironment, ExecutorService executorService) { ExtensibleConfigurationPersister persister = new AbstractConfigurationPersister(new StandaloneXml(configuration.getModuleLoader(), executorService, extensionRegistry)) { private final PersistenceResource pr = new PersistenceResource() { @Override public void commit() { } @Override public void rollback() { } }; @Override public PersistenceResource store(final ModelNode model, Set<PathAddress> affectedAddresses) throws ConfigurationPersistenceException { return pr; } @Override public List<ModelNode> load() throws ConfigurationPersistenceException { try { final ModelNode operations = bootOperations.get(); return operations.asList(); } catch (Exception e) { throw new ConfigurationPersistenceException(e); } } }; extensionRegistry.setWriterRegistry(persister); return persister; } }; configuration.setConfigurationPersisterFactory(configurationPersisterFactory); return bootstrap.bootstrap(configuration, services); }
Example 18
Source File: AbstractControllerTestBase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
public ModelControllerService(final ProcessType processType) { this(processType, new RunningModeControl(RunningMode.NORMAL)); }
Example 19
Source File: StandaloneXMLParserProducer.java From thorntail with Apache License 2.0 | 4 votes |
@Override public RunningMode getRunningMode() { return RunningMode.NORMAL; }
Example 20
Source File: AdditionalInitialization.java From wildfly-core with GNU Lesser General Public License v2.1 | 2 votes |
/** * Whether or not the runtime resources should be registered. If {@link RunningMode#ADMIN_ONLY} the runtime resources will not * get registered since {@link org.jboss.as.controller.ExtensionContext#isRuntimeOnlyRegistrationValid()} will return false. * * @return the running mode */ protected RunningMode getExtensionRegistryRunningMode() { return RunningMode.NORMAL; }