@Test
  public void testServerGroupsTransformer() throws Exception {

    boolean is71x = modelVersion.getMajor() == 1 && modelVersion.getMinor() < 4;
    KernelServicesBuilder builder =
        createKernelServicesBuilder(TestModelType.DOMAIN)
            .setModelInitializer(
                StandardServerGroupInitializers.XML_MODEL_INITIALIZER,
                StandardServerGroupInitializers.XML_MODEL_WRITE_SANITIZER)
            .createContentRepositoryContent("12345678901234567890")
            .createContentRepositoryContent("09876543210987654321")
            .setXmlResource(is71x ? "servergroup_1_3.xml" : "servergroup-with-expressions.xml");

    LegacyKernelServicesInitializer legacyInitializer =
        StandardServerGroupInitializers.addServerGroupInitializers(
            builder.createLegacyKernelServicesBuilder(modelVersion, testControllerVersion));
    if (is71x) {
      // The 7.1.x descriptions are inaccurate so we can't validate the add ops against them
      legacyInitializer.setDontValidateOperations();
    }

    KernelServices mainServices = builder.build();
    Assert.assertTrue(mainServices.isSuccessfulBoot());

    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertTrue(legacyServices.isSuccessfulBoot());

    checkCoreModelTransformation(mainServices, modelVersion, MODEL_FIXER, MODEL_FIXER);
  }
  public static void excludeBadOps_7_1_x(LegacyKernelServicesInitializer initializer) {
    // deployment overlays don't exist in 7.1.x
    initializer.addOperationValidationExclude(
        ADD, PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT_OVERLAY)));

    initializer.addOperationValidationExclude(
        ADD,
        PathAddress.pathAddress(
            PathElement.pathElement(DEPLOYMENT_OVERLAY), PathElement.pathElement(CONTENT)));
    initializer.addOperationValidationExclude(
        ADD,
        PathAddress.pathAddress(
            PathElement.pathElement(SERVER_GROUP), PathElement.pathElement(DEPLOYMENT_OVERLAY)));

    // Socket binding group/socket-binding has problems if there are expressions in the
    // multicast-port
    initializer.addOperationValidationResolve(
        ADD,
        PathAddress.pathAddress(
            PathElement.pathElement(SOCKET_BINDING_GROUP),
            PathElement.pathElement(SOCKET_BINDING)));

    // Deployment operation validator thinks that content is required
    initializer.addOperationValidationExclude(
        ADD,
        PathAddress.pathAddress(
            PathElement.pathElement(SERVER_GROUP), PathElement.pathElement(DEPLOYMENT)));
  }
  @Test
  public void testRejectTransformers71x() throws Exception {

    if (modelVersion.getMajor() > 1 || modelVersion.getMinor() > 3) {
      return;
    }

    KernelServicesBuilder builder =
        createKernelServicesBuilder(TestModelType.DOMAIN)
            .setModelInitializer(
                StandardServerGroupInitializers.XML_MODEL_INITIALIZER,
                StandardServerGroupInitializers.XML_MODEL_WRITE_SANITIZER)
            .createContentRepositoryContent("12345678901234567890")
            .createContentRepositoryContent("09876543210987654321");

    // Add legacy subsystems
    LegacyKernelServicesInitializer legacyInitializer =
        StandardServerGroupInitializers.addServerGroupInitializers(
                builder.createLegacyKernelServicesBuilder(modelVersion, testControllerVersion))
            // The reverse stuff is tested in the other test
            .skipReverseControllerCheck();
    // The 7.1.x descriptions are inaccurate so we can't validate the add ops against them
    legacyInitializer.setDontValidateOperations();

    KernelServices mainServices = builder.build();

    List<ModelNode> ops = builder.parseXmlResource("servergroup_1_3-with-expressions.xml");
    ModelTestUtils.checkFailedTransformedBootOperations(
        mainServices,
        modelVersion,
        ops,
        new FailedOperationTransformationConfig()
            .addFailedAttribute(
                PathAddress.pathAddress(PathElement.pathElement(SERVER_GROUP)),
                new FailedOperationTransformationConfig.RejectExpressionsConfig(
                        ServerGroupResourceDefinition.MANAGEMENT_SUBSYSTEM_ENDPOINT,
                        ServerGroupResourceDefinition.SOCKET_BINDING_PORT_OFFSET)
                    .setReadOnly(ServerGroupResourceDefinition.MANAGEMENT_SUBSYSTEM_ENDPOINT)));
  }