private void testTransformers(ModelTestControllerVersion controllerVersion) throws Exception {
    ModelVersion modelVersion = ModelVersion.create(1, 0, 0);
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());

    builder
        .createLegacyKernelServicesBuilder(
            createAdditionalInitialization(), controllerVersion, modelVersion)
        .addMavenResourceURL("org.jboss.as:jboss-as-cmp:" + controllerVersion.getMavenGavVersion())
        .configureReverseControllerCheck(createAdditionalInitialization(), null);

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

    ModelTestUtils.checkFailedTransformedBootOperations(
        mainServices,
        modelVersion,
        parse(getSubsystemXml()),
        new FailedOperationTransformationConfig()
            .addFailedAttribute(
                SUBSYSTEM_PATH.append(CmpSubsystemModel.UUID_KEY_GENERATOR_PATH),
                new FailedOperationTransformationConfig.NewAttributesConfig(
                    CMPSubsystemRootResourceDefinition.JNDI_NAME))
            .addFailedAttribute(
                SUBSYSTEM_PATH.append(CmpSubsystemModel.HILO_KEY_GENERATOR_PATH),
                new FailedOperationTransformationConfig.NewAttributesConfig(
                    CMPSubsystemRootResourceDefinition.JNDI_NAME)));
  }
  private void testRejections(final ModelTestControllerVersion controller) throws Exception {
    final ModelVersion version = getModelVersion(controller).getVersion();
    final String[] dependencies = getDependencies(controller);

    // create builder for current subsystem version
    KernelServicesBuilder builder = this.createKernelServicesBuilder();

    // initialize the legacy services
    builder
        .createLegacyKernelServicesBuilder(createAdditionalInitialization(), controller, version)
        .addSingleChildFirstClass(LegacyControllerAdditionalInitialization.class)
        .addMavenResourceURL(dependencies)
        // TODO storing the model triggers the weirdness mentioned in
        // SubsystemTestDelegate.LegacyKernelServiceInitializerImpl.install()
        // which is strange since it should be loading it all from the current jboss modules
        // Also this works in several other tests
        .dontPersistXml();

    KernelServices services = builder.build();
    KernelServices legacyServices = services.getLegacyServices(version);
    Assert.assertNotNull(legacyServices);
    Assert.assertTrue("main services did not boot", services.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());

    // test failed operations involving backups
    List<ModelNode> xmlOps = builder.parseXmlResource("infinispan-transformer-reject.xml");
    ModelTestUtils.checkFailedTransformedBootOperations(
        services, version, xmlOps, createFailedOperationConfig(version));
  }
  @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)));
  }
  /**
   * Tests rejection of expressions in 1.1.0 model.
   *
   * @throws Exception
   */
  private void doTestRejectExpressions_1_1_0(KernelServicesBuilder builder) throws Exception {
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    KernelServices legacyServices = mainServices.getLegacyServices(VERSION_1_1_0);
    assertNotNull(legacyServices);
    assertTrue(legacyServices.isSuccessfulBoot());

    // Use the real xml with expressions for testing all the attributes
    PathAddress subsystemAddress =
        PathAddress.pathAddress(pathElement(SUBSYSTEM, MessagingExtension.SUBSYSTEM_NAME));
    List<ModelNode> modelNodes = builder.parseXmlResource("subsystem_incompatible_1_3.xml");
    // remote the messaging subsystem add operation that fails on AS7 7.1.2.Final
    modelNodes.remove(0);
    checkFailedTransformedBootOperations(
        mainServices,
        VERSION_1_1_0,
        modelNodes,
        new FailedOperationTransformationConfig()
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH),
                new ChainedConfig(
                    new HashMap<String, FailedOperationTransformationConfig.PathAddressConfig>() {
                      {
                        configureAttributes(
                            this,
                            HornetQServerResourceDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0,
                            HornetQServerResourceDefinition.NEW_ATTRIBUTES_ADDED_AFTER_1_1_0);
                      }
                    }))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(pathElement(ModelDescriptionConstants.PATH)),
                new RejectExpressionsConfig(ModelDescriptionConstants.PATH))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(pathElement(CommonAttributes.IN_VM_CONNECTOR)),
                new RejectExpressionsConfig(InVMTransportDefinition.SERVER_ID))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(pathElement(CommonAttributes.CONNECTOR)),
                new RejectExpressionsConfig(CommonAttributes.FACTORY_CLASS))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(pathElement(CommonAttributes.IN_VM_ACCEPTOR)),
                new RejectExpressionsConfig(InVMTransportDefinition.SERVER_ID))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(pathElement(CommonAttributes.ACCEPTOR)),
                new RejectExpressionsConfig(CommonAttributes.FACTORY_CLASS))
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(BroadcastGroupDefinition.PATH),
                new RejectExpressionsConfig(BroadcastGroupDefinition.BROADCAST_PERIOD) {
                  @Override
                  public boolean expectFailed(ModelNode operation) {
                    if ("groupT"
                        .equals(
                            operation
                                .get(OP_ADDR)
                                .get(2)
                                .get(CommonAttributes.BROADCAST_GROUP)
                                .asString())) {
                      // groupT use JGroups and do not define socket-binding or local address
                      return true;
                    }
                    return super.expectFailed(operation);
                  }
                })
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(DiscoveryGroupDefinition.PATH),
                new RejectExpressionsConfig(
                    DiscoveryGroupDefinition.REFRESH_TIMEOUT,
                    DiscoveryGroupDefinition.INITIAL_WAIT_TIMEOUT) {
                  @Override
                  public boolean expectFailed(ModelNode operation) {
                    if ("groupU"
                        .equals(
                            operation
                                .get(OP_ADDR)
                                .get(2)
                                .get(CommonAttributes.DISCOVERY_GROUP)
                                .asString())) {
                      // groupU use JGroups and do not define socket-binding or local address
                      return true;
                    }
                    return super.expectFailed(operation);
                  }
                })
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(DivertDefinition.PATH),
                new RejectExpressionsConfig(
                    DivertDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0))
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(QueueDefinition.PATH),
                new RejectExpressionsConfig(QueueDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(ClusterConnectionDefinition.PATH),
                new ChainedConfig(
                    new HashMap<String, FailedOperationTransformationConfig.PathAddressConfig>() {
                      {
                        configureAttributes(
                            this,
                            ClusterConnectionDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0,
                            ClusterConnectionDefinition.NEW_ATTRIBUTES_ADDED_AFTER_1_1_0);
                      }
                    }))
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(BridgeDefinition.PATH),
                new RejectExpressionsConfig(
                    BridgeDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0))
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(GroupingHandlerDefinition.PATH),
                new RejectExpressionsConfig(
                    GroupingHandlerDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0))
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(AddressSettingDefinition.PATH),
                new RejectExpressionsConfig(
                    AddressSettingDefinition.REJECTED_EXPRESSION_ATTRIBUTES))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(ConnectorServiceDefinition.PATH),
                new RejectExpressionsConfig(CommonAttributes.FACTORY_CLASS))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(ConnectorServiceDefinition.PATH)
                    .append(ConnectorServiceParamDefinition.PATH),
                new RejectExpressionsConfig(ConnectorServiceParamDefinition.VALUE))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(ConnectionFactoryDefinition.PATH),
                new ChainedConfig(
                        new HashMap<
                            String, FailedOperationTransformationConfig.PathAddressConfig>() {
                          {
                            configureAttributes(
                                this,
                                ConnectionFactoryDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0,
                                new AttributeDefinition[] {CALL_FAILOVER_TIMEOUT});
                          }
                        })
                    .setReadOnly(FACTORY_TYPE))
            .addFailedAttribute(
                subsystemAddress
                    .append(HORNETQ_SERVER_PATH)
                    .append(PooledConnectionFactoryDefinition.PATH),
                new ChainedConfig(
                        new HashMap<
                            String, FailedOperationTransformationConfig.PathAddressConfig>() {
                          {
                            configureAttributes(
                                this,
                                PooledConnectionFactoryDefinition
                                    .ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0,
                                PooledConnectionFactoryDefinition.NEW_ATTRIBUTES_ADDED_AFTER_1_1_0);
                          }
                        })
                    .setReadOnly(ConnectionFactoryAttributes.Pooled.TRANSACTION))
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(JMSQueueDefinition.PATH),
                new RejectExpressionsConfig(
                    JMSQueueDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0))
            .addFailedAttribute(
                subsystemAddress.append(HORNETQ_SERVER_PATH).append(JMSTopicDefinition.PATH),
                new RejectExpressionsConfig(
                    JMSTopicDefinition.ATTRIBUTES_WITH_EXPRESSION_AFTER_1_1_0))
            .addFailedAttribute(
                subsystemAddress.append(JMSBridgeDefinition.PATH),
                new RejectExpressionsConfig(new String[0]) {
                  @Override
                  public boolean expectFailed(ModelNode operation) {
                    // jms-bridge resource was introduced in version 1.2.0
                    return true;
                  }
                }));
  }