Resource createRootResource() {
    final Resource rootResource = Resource.Factory.create();

    CoreManagementResourceDefinition.registerDomainResource(rootResource);

    final Resource host = Resource.Factory.create();
    final Resource serverOneConfig = Resource.Factory.create();
    final ModelNode serverOneModel = new ModelNode();
    serverOneModel.get(GROUP).set("group-one");
    serverOneModel.get(SOCKET_BINDING_GROUP).set("binding-one");
    serverOneConfig.writeModel(serverOneModel);
    host.registerChild(PathElement.pathElement(SERVER_CONFIG, "server-one"), serverOneConfig);

    final Resource serverTwoConfig = Resource.Factory.create();
    final ModelNode serverTwoModel = new ModelNode();
    serverTwoModel.get(GROUP).set("group-one");
    serverTwoConfig.writeModel(serverTwoModel);
    host.registerChild(PathElement.pathElement(SERVER_CONFIG, "server-two"), serverTwoConfig);

    final Resource serverThreeConfig = Resource.Factory.create();
    final ModelNode serverThreeModel = new ModelNode();
    serverThreeModel.get(GROUP).set("group-two");
    serverThreeConfig.writeModel(serverThreeModel);
    host.registerChild(PathElement.pathElement(SERVER_CONFIG, "server-three"), serverThreeConfig);

    rootResource.registerChild(PathElement.pathElement(HOST, "localhost"), host);

    final Resource serverGroup1 = Resource.Factory.create();
    serverGroup1.getModel().get(PROFILE).set("profile-one");
    serverGroup1.getModel().get(SOCKET_BINDING_GROUP).set("binding-one");
    rootResource.registerChild(PathElement.pathElement(SERVER_GROUP, "group-one"), serverGroup1);

    final Resource serverGroup2 = Resource.Factory.create();
    serverGroup2.getModel().get(PROFILE).set("profile-2");
    serverGroup2.getModel().get(SOCKET_BINDING_GROUP).set("binding-two");
    rootResource.registerChild(PathElement.pathElement(SERVER_GROUP, "group-two"), serverGroup2);

    final Resource profile1 = Resource.Factory.create();
    profile1.getModel().setEmptyObject();
    rootResource.registerChild(PathElement.pathElement(PROFILE, "profile-one"), profile1);
    final Resource profile2 = Resource.Factory.create();
    profile2.getModel().setEmptyObject();
    rootResource.registerChild(PathElement.pathElement(PROFILE, "profile-two"), profile2);

    final Resource binding1 = Resource.Factory.create();
    binding1.getModel().setEmptyObject();
    rootResource.registerChild(
        PathElement.pathElement(SOCKET_BINDING_GROUP, "binding-one"), binding1);
    final Resource binding2 = Resource.Factory.create();
    binding2.getModel().setEmptyObject();
    rootResource.registerChild(
        PathElement.pathElement(SOCKET_BINDING_GROUP, "binding-two"), binding2);

    hack(rootResource, EXTENSION);
    hack(rootResource, PATH);
    hack(rootResource, SYSTEM_PROPERTY);
    hack(rootResource, INTERFACE);
    hack(rootResource, DEPLOYMENT);
    return rootResource;
  }
    @Override
    public void initCoreModel(
        Resource rootResource,
        ManagementResourceRegistration rootRegistration,
        Resource modelControllerResource) {
      VersionModelInitializer.registerRootResource(rootResource, null);
      final HostControllerEnvironment env = createHostControllerEnvironment();
      final LocalHostControllerInfoImpl info = createLocalHostControllerInfo(env);
      final IgnoredDomainResourceRegistry ignoredRegistry = new IgnoredDomainResourceRegistry(info);
      final ExtensibleConfigurationPersister persister = new NullConfigurationPersister();
      final HostFileRepository hostFileRepository = createHostFileRepository();
      final DomainController domainController = new MockDomainController();

      DomainRootDefinition domainDefinition =
          new DomainRootDefinition(
              domainController,
              env,
              persister,
              injectedContentRepository.getValue(),
              hostFileRepository,
              true,
              info,
              extensionRegistry,
              null,
              pathManagerService,
              null,
              authorizer,
              null,
              getMutableRootResourceRegistrationProvider());
      domainDefinition.initialize(rootRegistration);
      rootResourceDefinition.setDelegate(domainDefinition);

      HostModelUtil.createRootRegistry(
          rootRegistration,
          env,
          ignoredRegistry,
          new HostModelRegistrar() {

            @Override
            public void registerHostModel(String hostName, ManagementResourceRegistration root) {}
          },
          processType,
          authorizer,
          modelControllerResource);

      CoreManagementResourceDefinition.registerDomainResource(rootResource, null);
    }
  protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    PathManagerService pathManagerService = new PathManagerService() {};
    GlobalOperationHandlers.registerGlobalOperations(registration, processType);
    registration.registerOperationHandler(
        CompositeOperationHandler.DEFINITION, CompositeOperationHandler.INSTANCE);

    GlobalNotifications.registerGlobalNotifications(registration, processType);

    registration.registerReadOnlyAttribute(
        LAUNCH_TYPE,
        new OperationStepHandler() {

          @Override
          public void execute(OperationContext context, ModelNode operation)
              throws OperationFailedException {
            context.getResult().set(TYPE_STANDALONE);
          }
        });

    TestServiceListener listener = new TestServiceListener();
    listener.reset(1);
    getContainer()
        .addService(PathManagerService.SERVICE_NAME, pathManagerService)
        .addListener(listener)
        .install();

    try {
      listener.latch.await(10, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException(e);
    }

    registration.registerSubModel(PathResourceDefinition.createSpecified(pathManagerService));
    registration.registerSubModel(
        CoreManagementResourceDefinition.forStandaloneServer(
            getAuthorizer(),
            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]));

    Resource rootResource = managementModel.getRootResource();
    pathManagerService.addPathManagerResources(rootResource);

    ExtensionRegistry extensionRegistry =
        new ExtensionRegistry(
            ProcessType.STANDALONE_SERVER,
            new RunningModeControl(RunningMode.NORMAL),
            AuditLogger.NO_OP_LOGGER,
            getAuthorizer(),
            RuntimeHostControllerInfoAccessor.SERVER);
    extensionRegistry.setPathManager(pathManagerService);
    extensionRegistry.setWriterRegistry(new NullConfigurationPersister());
    JMXExtension extension = new JMXExtension();
    extension.initialize(
        extensionRegistry.getExtensionContext(
            "org.jboss.as.jmx", registration, 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);
  }
  @Override
  public void registerChildren(ManagementResourceRegistration hostRegistration) {
    super.registerChildren(hostRegistration);

    // System Properties
    hostRegistration.registerSubModel(
        SystemPropertyResourceDefinition.createForDomainOrHost(
            SystemPropertyResourceDefinition.Location.HOST));

    /////////////////////////////////////////
    // Core Services

    // vault
    hostRegistration.registerSubModel(new VaultResourceDefinition(vaultReader));

    // Central Management
    ResourceDefinition nativeManagement =
        new NativeManagementResourceDefinition(hostControllerInfo);
    ResourceDefinition httpManagement =
        new HttpManagementResourceDefinition(hostControllerInfo, environment);

    // audit log environment reader
    final EnvironmentNameReader environmentNameReader =
        new EnvironmentNameReader() {
          public boolean isServer() {
            return false;
          }

          public String getServerName() {
            return null;
          }

          public String getHostName() {
            return environment.getHostControllerName();
          }

          public String getProductName() {
            if (environment.getProductConfig() != null
                && environment.getProductConfig().getProductName() != null) {
              return environment.getProductConfig().getProductName();
            }
            return null;
          }
        };
    hostRegistration.registerSubModel(
        CoreManagementResourceDefinition.forHost(
            authorizer,
            auditLogger,
            pathManager,
            environmentNameReader,
            bootErrorCollector,
            nativeManagement,
            httpManagement));

    // Other core services
    // TODO get a DumpServicesHandler that works on the domain
    //        ManagementResourceRegistration serviceContainer =
    // hostRegistration.registerSubModel(PathElement.pathElement(CORE_SERVICE, SERVICE_CONTAINER),
    // CommonProviders.SERVICE_CONTAINER_PROVIDER);
    //        serviceContainer.registerOperationHandler(DumpServicesHandler.OPERATION_NAME,
    // DumpServicesHandler.INSTANCE, DumpServicesHandler.INSTANCE, false);

    // host-environment
    hostRegistration.registerSubModel(HostEnvironmentResourceDefinition.of(environment));
    hostRegistration.registerSubModel(new ModuleLoadingResourceDefinition());

    // discovery options
    ManagementResourceRegistration discoveryOptions =
        hostRegistration.registerSubModel(DiscoveryOptionsResourceDefinition.INSTANCE);
    discoveryOptions.registerSubModel(new StaticDiscoveryResourceDefinition(hostControllerInfo));
    discoveryOptions.registerSubModel(new DiscoveryOptionResourceDefinition(hostControllerInfo));

    // Jvms
    final ManagementResourceRegistration jvms =
        hostRegistration.registerSubModel(JvmResourceDefinition.GLOBAL);

    // Paths
    hostRegistration.registerSubModel(
        PathResourceDefinition.createResolvableSpecified(pathManager));

    // interface
    ManagementResourceRegistration interfaces =
        hostRegistration.registerSubModel(
            new InterfaceDefinition(
                new HostSpecifiedInterfaceAddHandler(),
                new HostSpecifiedInterfaceRemoveHandler(),
                true,
                true));
    interfaces.registerOperationHandler(
        SpecifiedInterfaceResolveHandler.DEFINITION, SpecifiedInterfaceResolveHandler.INSTANCE);

    // server configurations
    hostRegistration.registerSubModel(
        new ServerConfigResourceDefinition(hostControllerInfo, serverInventory, pathManager));
    hostRegistration.registerSubModel(new StoppedServerResource(serverInventory));
  }