org.jboss.as.controller.ModelVersion Java Examples

The following examples show how to use org.jboss.as.controller.ModelVersion. 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: RemotingSubsystemTransformersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void testRejectingTransformers(ModelTestControllerVersion controllerVersion, ModelVersion messagingVersion) throws Exception {
    //Boot up empty controllers with the resources needed for the ops coming from the xml to work
    KernelServicesBuilder builder = createKernelServicesBuilder(DEFAULT_ADDITIONAL_INITIALIZATION);
    builder.createLegacyKernelServicesBuilder(DEFAULT_ADDITIONAL_INITIALIZATION, controllerVersion, messagingVersion)
            .addMavenResourceURL(controllerVersion.getCoreMavenGroupId() + ":wildfly-remoting:" + controllerVersion.getCoreVersion())
            .dontPersistXml();

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

    List<ModelNode> ops = builder.parseXmlResource("remoting.xml");
    PathAddress subsystemAddress = PathAddress.pathAddress("subsystem", RemotingExtension.SUBSYSTEM_NAME);
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, messagingVersion, ops, new FailedOperationTransformationConfig()
            .addFailedAttribute(subsystemAddress.append(ConnectorResource.PATH),
                    new FailedOperationTransformationConfig.NewAttributesConfig(
                            ConnectorCommon.SASL_AUTHENTICATION_FACTORY,
                            ConnectorResource.SSL_CONTEXT
                    )
            )
            .addFailedAttribute(subsystemAddress.append(HttpConnectorResource.PATH),
                    new FailedOperationTransformationConfig.NewAttributesConfig(ConnectorCommon.SASL_AUTHENTICATION_FACTORY))
            .addFailedAttribute(subsystemAddress.append(RemoteOutboundConnectionResourceDefinition.ADDRESS),
                    new FailedOperationTransformationConfig.NewAttributesConfig(ConnectorCommon.SASL_AUTHENTICATION_FACTORY))
    );
}
 
Example #2
Source File: OperationTransformationTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testAddSubsystem() throws Exception {

    final ModelVersion subsystem = ModelVersion.create(1, 2);
    final TransformerRegistry registry = TransformerRegistry.Factory.create();
    TransformersSubRegistration sub = registry.registerSubsystemTransformers("test", subsystem, ResourceTransformer.DISCARD);
    sub.registerOperationTransformer("test", OPERATION_TRANSFORMER);

    final TransformationTarget host = create(registry, ModelVersion.create(1, 2, 3));
    host.addSubsystemVersion("test", subsystem);

    final PathAddress profile = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.PROFILE, "test"));
    final PathAddress serverAddress = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.HOST, "test"), PathElement.pathElement(ModelDescriptionConstants.RUNNING_SERVER, "test"));
    final PathAddress subsytemAddress = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "test"));

    final OperationTransformer profileTransformer = host.resolveTransformer(new MockTransformationContext(), profile.append(subsytemAddress), "test");
    Assert.assertEquals(profileTransformer, OPERATION_TRANSFORMER);

    final OperationTransformer serverTransformer = host.resolveTransformer(new MockTransformationContext(), serverAddress.append(subsytemAddress), "test");
    Assert.assertEquals(serverTransformer, OPERATION_TRANSFORMER);

}
 
Example #3
Source File: LoggingSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testFailedTransformersEAP700() throws Exception {
    final ModelTestControllerVersion controllerVersion = ModelTestControllerVersion.EAP_7_0_0;
    final ModelVersion modelVersion = ModelVersion.create(3, 0, 0);

    // Test against current
    testEap7FailedTransformers(controllerVersion, modelVersion, readResource("/expressions.xml"),
            new FailedOperationTransformationConfig()
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append("json-formatter"),
                            FailedOperationTransformationConfig.REJECTED_RESOURCE)
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append("xml-formatter"),
                            FailedOperationTransformationConfig.REJECTED_RESOURCE)
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append("socket-handler"),
                            FailedOperationTransformationConfig.REJECTED_RESOURCE)
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append("syslog-handler"),
                            new NewAttributesConfig(SyslogHandlerResourceDefinition.NAMED_FORMATTER))
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append(CommonAttributes.LOGGING_PROFILE).append("socket-handler"),
                            FailedOperationTransformationConfig.REJECTED_RESOURCE)
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append(CommonAttributes.LOGGING_PROFILE).append("syslog-handler"),
                            new NewAttributesConfig(SyslogHandlerResourceDefinition.NAMED_FORMATTER))
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append("filter"),
                            FailedOperationTransformationConfig.REJECTED_RESOURCE)
                    .addFailedAttribute(SUBSYSTEM_ADDRESS.append(CommonAttributes.LOGGING_PROFILE).append("filter"),
                            FailedOperationTransformationConfig.REJECTED_RESOURCE));
}
 
Example #4
Source File: BasicResourceTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testRenameOperation() throws Exception {

    final ModelNode address = new ModelNode();
    address.add("toto", "testSubsystem");

    final ModelNode operation = new ModelNode();
    operation.get(ModelDescriptionConstants.OP).set("rename-operation");
    operation.get(ModelDescriptionConstants.OP_ADDR).set(address);
    operation.get("param").set("test");

    validateRenamedOperation(operation, ModelVersion.create(1));
    validateRenamedOperation(operation, ModelVersion.create(1, 0, 1));
    validateRenamedOperation(operation, ModelVersion.create(1, 0, 5));

    OperationTransformer.TransformedOperation op = transformOperation(ModelVersion.create(1, 1), operation);
    final ModelNode notTransformed = op.getTransformedOperation();
    Assert.assertEquals("rename-operation", notTransformed.get(OP).asString());
}
 
Example #5
Source File: AsyncHandlerResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void registerOperations(final ManagementResourceRegistration registration) {
    super.registerOperations(registration);
    final ResourceDescriptionResolver resourceDescriptionResolver = getResourceDescriptionResolver();
    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(ADD_SUBHANDLER_OPERATION_NAME, resourceDescriptionResolver)
            .setDeprecated(ModelVersion.create(1, 2, 0))
            .setParameters(CommonAttributes.HANDLER_NAME)
            .build(), HandlerOperations.ADD_SUBHANDLER);

    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(REMOVE_SUBHANDLER_OPERATION_NAME, resourceDescriptionResolver)
            .setDeprecated(ModelVersion.create(1, 2, 0))
            .setParameters(CommonAttributes.HANDLER_NAME)
            .build(), HandlerOperations.REMOVE_SUBHANDLER);

    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(ADD_HANDLER_OPERATION_NAME, resourceDescriptionResolver)
            .setParameters(CommonAttributes.HANDLER_NAME)
            .build(), HandlerOperations.ADD_SUBHANDLER);

    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(REMOVE_HANDLER_OPERATION_NAME, resourceDescriptionResolver)
            .setParameters(CommonAttributes.HANDLER_NAME)
            .build(), HandlerOperations.REMOVE_SUBHANDLER);
}
 
Example #6
Source File: ReadTransformedResourceOperation.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private ModelNode transformReadResourceResult(final OperationContext context, ModelNode original, String subsystem) throws OperationFailedException {
    ModelNode rootData = original.get(ModelDescriptionConstants.RESULT);

    Map<PathAddress, ModelVersion> subsystemVersions = new HashMap<>();
    subsystemVersions.put(PathAddress.EMPTY_ADDRESS.append(ModelDescriptionConstants.SUBSYSTEM, subsystem), subsystemModelVersion);

    final TransformationTarget target = TransformationTargetImpl.create(null, transformerRegistry, coreModelVersion,
            subsystemVersions, TransformationTarget.TransformationTargetType.SERVER);
    final Transformers transformers = Transformers.Factory.create(target);

    final ImmutableManagementResourceRegistration rr = context.getRootResourceRegistration();
    Resource root = TransformationUtils.modelToResource(rr, rootData, true);
    Transformers.TransformationInputs transformationInputs = Transformers.TransformationInputs.getOrCreate(context);
    Resource transformed = transformers.transformRootResource(transformationInputs, root);

    return Resource.Tools.readModel(transformed);
}
 
Example #7
Source File: ExtensionRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private SubsystemRegistrationImpl(String name, ModelVersion version,
                                  ManagementResourceRegistration profileRegistration,
                                  ManagementResourceRegistration deploymentsRegistration,
                                  ExtensionRegistryType extensionRegistryType,
                                  String extensionModuleName,
                                  ProcessType processType) {
    assert profileRegistration != null;
    this.name = name;
    this.profileRegistration = profileRegistration;
    if (deploymentsRegistration == null){
        this.deploymentsRegistration = ManagementResourceRegistration.Factory.forProcessType(processType).createRegistration(new SimpleResourceDefinition(null, NonResolvingResourceDescriptionResolver.INSTANCE));
    }else {
        this.deploymentsRegistration = deploymentsRegistration;
    }
    this.version = version;
    this.extensionRegistryType = extensionRegistryType;
    this.extensionModuleName = extensionModuleName;
}
 
Example #8
Source File: CoreModelTestDelegate.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void harmonizeModel(ModelVersion modelVersion, ModelNode legacyModel, ModelNode transformed,
                                              PathAddress address, ModelHarmonizer harmonizer) {

    if (address.size() > 0) {
        PathElement pathElement = address.getElement(0);
        if (legacyModel.hasDefined(pathElement.getKey()) && transformed.hasDefined(pathElement.getKey())) {
            ModelNode legacyType = legacyModel.get(pathElement.getKey());
            ModelNode transformedType = transformed.get(pathElement.getKey());
            PathAddress childAddress = address.size() > 1 ? address.subAddress(1) : PathAddress.EMPTY_ADDRESS;
            if (pathElement.isWildcard()) {
                for (String key : legacyType.keys()) {
                    if (transformedType.has(key)) {
                        harmonizeModel(modelVersion, legacyType.get(key),
                                transformedType.get(key), childAddress, harmonizer);
                    }
                }
            } else {
                harmonizeModel(modelVersion, legacyType.get(pathElement.getValue()),
                        transformedType.get(pathElement.getValue()), address, harmonizer);
            }
        }
    } else {
        harmonizer.harmonizeModel(modelVersion, legacyModel, transformed);
    }
}
 
Example #9
Source File: BasicResourceTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testOperationOverride() throws Exception {

    final ModelNode address = new ModelNode();
    address.add("toto", "testSubsystem");

    final ModelNode operation = new ModelNode();
    operation.get(ModelDescriptionConstants.OP).set("test-operation");
    operation.get(ModelDescriptionConstants.OP_ADDR).set(address);
    operation.get("test").set("${one:two}");

    validateOperationOverride(operation, ModelVersion.create(1));
    validateOperationOverride(operation, ModelVersion.create(1, 0, 1));
    validateOperationOverride(operation, ModelVersion.create(1, 0, 5));

    OperationTransformer.TransformedOperation op = transformOperation(ModelVersion.create(1, 1), operation);
    Assert.assertFalse(op.rejectOperation(success())); // inherited
}
 
Example #10
Source File: CamelExtension.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(ExtensionContext context) {

    boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();
    ModelVersion modelVersion = ModelVersion.create(MANAGEMENT_API_MAJOR_VERSION, MANAGEMENT_API_MINOR_VERSION, MANAGEMENT_API_MICRO_VERSION);
    SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, modelVersion);
    subsystem.registerSubsystemModel(new CamelRootResource(registerRuntimeOnly));

    subsystem.registerXMLElementWriter(CamelSubsystemWriter.INSTANCE);
}
 
Example #11
Source File: XmlAuthenticationResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public XmlAuthenticationResourceDefinition() {
    super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.USERS),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY,
                    "core.management.security-realm.authentication.xml"))
            .setAddHandler(new SecurityRealmChildAddHandler(true, false))
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(true))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #12
Source File: TransformerRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public TransformersSubRegistration registerSubResource(PathElement element, PathAddressTransformer pathAddressTransformer, ResourceTransformer resourceTransformer, OperationTransformer operationTransformer, boolean inherited, boolean placeholder) {
    final PathAddress address = current.append(element);
    for(final ModelVersion version : range.getVersions()) {
        registry.createChildRegistry(address, version, pathAddressTransformer, resourceTransformer, operationTransformer, inherited, placeholder);
    }
    return new TransformersSubRegistrationImpl(range, registry, address);
}
 
Example #13
Source File: RejectExpressionValuesTransformer.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void transformResource(final ResourceTransformationContext context, final PathAddress address,
                              final Resource resource) throws OperationFailedException {
    // Check the model
    final ModelNode model = resource.getModel();
    final Set<String> attributes = checkModel(model, context);
    if (attributes.size() > 0) {
        if (context.getTarget().isIgnoredResourceListAvailableAtRegistration()) {
            // Slave is 7.2.x or higher and we know this resource is not ignored
            List<String> msg = Collections.singletonList(context.getLogger().getAttributeWarning(address, null, ControllerLogger.ROOT_LOGGER.attributesDontSupportExpressions(), attributes));

            final TransformationTarget tgt = context.getTarget();
            final String legacyHostName = tgt.getHostName();
            final ModelVersion coreVersion = tgt.getVersion();
            final String subsystemName = findSubsystemName(address);
            final ModelVersion usedVersion = subsystemName == null ? coreVersion : tgt.getSubsystemVersion(subsystemName);

            // Target is  7.2.x or higher so we should throw an error
            if (subsystemName != null) {
                throw ControllerLogger.ROOT_LOGGER.rejectAttributesSubsystemModelResourceTransformer(address, legacyHostName, subsystemName, usedVersion, msg);
            }
            throw ControllerLogger.ROOT_LOGGER.rejectAttributesCoreModelResourceTransformer(address, legacyHostName, usedVersion, msg);
        } else {
            // 7.1.x slave; resource *may* be ignored so we can't fail; just log
            context.getLogger().logAttributeWarning(address, ControllerLogger.ROOT_LOGGER.attributesDontSupportExpressions(), attributes);
        }
    }

    final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource);
    childContext.processChildren(resource);
}
 
Example #14
Source File: TransformerRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Resolve the host registry.
 *
 * @param mgmtVersion the mgmt version
 * @param subsystems the subsystems
 * @return the transformer registry
 */
public OperationTransformerRegistry resolveHost(final ModelVersion mgmtVersion, final Map<PathAddress, ModelVersion> subsystems) {
    // The domain / host / servers
    final OperationTransformerRegistry root = domain.create(mgmtVersion, Collections.<PathAddress, ModelVersion>emptyMap());
    subsystem.mergeSubtree(root, PathAddress.pathAddress(PROFILE), subsystems);
    subsystem.mergeSubtree(root, PathAddress.pathAddress(HOST, SERVER), subsystems);
    return root;
}
 
Example #15
Source File: ChainedResourceBuilderTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Before
public void setUp() {
    // Cleanup
    resourceRoot = Resource.Factory.create();
    registry = TransformerRegistry.Factory.create();
    resourceRegistration = ManagementResourceRegistration.Factory.forProcessType(ProcessType.EMBEDDED_SERVER).createRegistration(ROOT);
    // test
    toto = Resource.Factory.create();
    resourceRoot.registerChild(PATH, toto);
    resourceModel = toto.getModel();

    // Register the description
    transformersSubRegistration = registry.getServerRegistration(ModelVersion.create(1));
}
 
Example #16
Source File: IOSubsystemTransformerTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void testTransformation(final ModelTestControllerVersion controllerVersion) throws Exception {
    final ModelVersion version = controllerVersion.getSubsystemModelVersion(getMainSubsystemName());
    final String xml = readResource(String.format("io-%d.0-transformer.xml", version.getMajor()));

    KernelServices services = this.buildKernelServices(xml, controllerVersion, version,
            controllerVersion.getCoreMavenGroupId() + ":wildfly-io:" + controllerVersion.getCoreVersion());

    // check that both versions of the legacy model are the same and valid
    checkSubsystemModelTransformation(services, version, null, false);

    ModelNode transformed = services.readTransformedModel(version);
    Assert.assertTrue(transformed.isDefined());
}
 
Example #17
Source File: LdapCacheResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private LdapCacheResourceDefinition(final PathElement pathElement,
        final SimpleAttributeDefinition[] configurationAttributes, final SimpleAttributeDefinition[] runtimeAttributes,
        final SimpleOperationDefinition[] runtimeOperations, final OperationStepHandler runtimeStepHandler) {
    super(new Parameters(pathElement, ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY,
                    "core.management.security-realm.ldap.cache"))
            .setAddHandler(new CacheChildAddHandler(configurationAttributes))
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(false))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
    this.configurationAttributes = configurationAttributes;
    this.runtimeAttributes = runtimeAttributes;
    this.runtimeOperations = runtimeOperations;
    this.runtimeStepHandler = runtimeStepHandler;
}
 
Example #18
Source File: GlobalTransformerRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public OperationTransformerRegistry.OperationTransformerEntry resolveTransformer(Iterator<PathElement> iterator, String value, ModelVersion version, String operationName) {
    final GlobalTransformerRegistry registry = childrenUpdater.get(this, value);
    if(registry == null) {
        return null;
    }
    return registry.resolveTransformer(iterator, version, operationName);
}
 
Example #19
Source File: AbstractKernelServicesImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected AbstractKernelServicesImpl(ServiceContainer container, ModelTestModelControllerService controllerService,
                StringConfigurationPersister persister, ManagementResourceRegistration rootRegistration,
                OperationValidator operationValidator, String mainSubsystemName,
                ExtensionRegistry extensionRegistry, ModelVersion legacyModelVersion, boolean successfulBoot,
                Throwable bootError, boolean registerTransformers) {
    super(container, controllerService, persister, rootRegistration, operationValidator, legacyModelVersion, successfulBoot, bootError);

    this.mainSubsystemName = mainSubsystemName;
    this.extensionRegistry = extensionRegistry;
    this.registerTransformers = registerTransformers;
}
 
Example #20
Source File: HostExcludeResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static DomainHostExcludeRegistry.VersionKey getVersionKey(OperationContext context, ModelNode model) throws OperationFailedException {
    ModelNode release = HOST_RELEASE.resolveModelAttribute(context, model);
    if (release.isDefined()) {
        KnownRelease kr = KnownRelease.fromName(release.asString());
        ModelVersion modelVersion = kr.kernelAPIVersion.getModelVersion();
        return new DomainHostExcludeRegistry.VersionKey(modelVersion.getMajor(), modelVersion.getMinor(), modelVersion.getMicro());
    } else {
        int major = MANAGEMENT_MAJOR_VERSION.resolveModelAttribute(context, model).asInt();
        int minor = MANAGEMENT_MINOR_VERSION.resolveModelAttribute(context, model).asInt();
        ModelNode micro = MANAGEMENT_MICRO_VERSION.resolveModelAttribute(context, model);
        return new DomainHostExcludeRegistry.VersionKey(major, minor, micro.asIntOrNull());
    }
}
 
Example #21
Source File: KnownVersions.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void addSubsystemVersion(Map<String, Map<ModelVersion, ModelVersion>> map, String subsystem, String subsystemVersion, String coreVersion) {
    ModelVersion subsystemModelVersion = ModelVersion.fromString(subsystemVersion);
    ModelVersion coreModelVersion = ModelVersion.fromString(coreVersion);
    Map<ModelVersion, ModelVersion> versionMap = map.get(subsystem);
    if (versionMap == null) {
        versionMap = new HashMap<ModelVersion, ModelVersion>();
        map.put(subsystem, versionMap);
    }
    versionMap.put(subsystemModelVersion, coreModelVersion);
}
 
Example #22
Source File: RemotingSubsystemTransformersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void testRejectingTransformers64(ModelTestControllerVersion controllerVersion) throws Exception {
    ModelVersion targetModelVersion = controllerVersion.getSubsystemModelVersion(getMainSubsystemName());
    //Boot up empty controllers with the resources needed for the ops coming from the xml to work
    KernelServicesBuilder builder = createKernelServicesBuilder(DEFAULT_ADDITIONAL_INITIALIZATION);
    builder.createLegacyKernelServicesBuilder(DEFAULT_ADDITIONAL_INITIALIZATION, controllerVersion, targetModelVersion)
            .addMavenResourceURL(controllerVersion.getMavenGav("remoting", true))
            .dontPersistXml();

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

    List<ModelNode> ops = builder.parseXmlResource("remoting.xml");
    PathAddress subsystemAddress = PathAddress.pathAddress("subsystem", RemotingExtension.SUBSYSTEM_NAME);
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, targetModelVersion, ops, new FailedOperationTransformationConfig()
            .addFailedAttribute(subsystemAddress,
                    new FailedOperationTransformationConfig.NewAttributesConfig(ENDPOINT_ATTRS))
            .addFailedAttribute(subsystemAddress.append(RemotingEndpointResource.ENDPOINT_PATH),
                    new FailedOperationTransformationConfig.NewAttributesConfig(ENDPOINT_ATTRS))
            .addFailedAttribute(subsystemAddress.append(ConnectorResource.PATH),
                    new FailedOperationTransformationConfig.NewAttributesConfig(
                            ConnectorCommon.SASL_AUTHENTICATION_FACTORY,
                            ConnectorResource.SSL_CONTEXT
                    )
            )
            .addFailedAttribute(subsystemAddress.append(HttpConnectorResource.PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE)
            .addFailedAttribute(subsystemAddress.append(HttpConnectorResource.PATH).append(PropertyResource.PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE)
            .addFailedAttribute(subsystemAddress.append(HttpConnectorResource.PATH).append(SaslResource.SASL_CONFIG_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE)
            .addFailedAttribute(subsystemAddress.append(HttpConnectorResource.PATH).append(SaslResource.SASL_CONFIG_PATH).append(PropertyResource.PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE)
            .addFailedAttribute(subsystemAddress.append(HttpConnectorResource.PATH).append(SaslResource.SASL_CONFIG_PATH).append(SaslPolicyResource.SASL_POLICY_CONFIG_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE)
            .addFailedAttribute(subsystemAddress.append(RemoteOutboundConnectionResourceDefinition.ADDRESS),
                    new FailedOperationTransformationConfig.NewAttributesConfig(ConnectorCommon.SASL_AUTHENTICATION_FACTORY))
    );
}
 
Example #23
Source File: LocalAuthenticationResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public LocalAuthenticationResourceDefinition() {
    super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.LOCAL),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY,
                    "core.management.security-realm.authentication.local"))
            .setAddHandler(new SecurityRealmChildAddHandler(true, false, ATTRIBUTE_DEFINITIONS))
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(true))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #24
Source File: SecretServerIdentityResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public SecretServerIdentityResourceDefinition() {
    super(new Parameters(PathElement.pathElement(SERVER_IDENTITY, SECRET),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY,
                    "core", "management", "security-realm", "server-identity", "secret"))
            .setAddHandler(new SecurityRealmChildAddHandler(false, false, ATTRIBUTE_DEFINITIONS))
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(false))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #25
Source File: ChainedOperationBuilderTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void assertNotRejectedOperation(ModelNode original, ModelNode expected) throws OperationFailedException {
    OperationTransformer.TransformedOperation op;
    for (ModelVersion version : VALID_TESTED_VERSIONS) {
        op = transformOperation(original, version);
        Assert.assertFalse(op.rejectOperation(success()));
        Assert.assertEquals(expected, op.getTransformedOperation());
    }
    op = transformOperation(original, UNKNOWN_VERSION);
    Assert.assertFalse(op.rejectOperation(success()));
    Assert.assertEquals(original, op.getTransformedOperation());
}
 
Example #26
Source File: PlugInResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public PlugInResourceDefinition() {
    super(new Parameters(PathElement.pathElement(PLUG_IN),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY, "core.management.security-realm.plug-in"))
            .setAddHandler(new SecurityRealmChildAddHandler(false, false))
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(true))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #27
Source File: RemotingSubsystemTransformersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void checkReject(ModelNode operation, KernelServices mainServices, ModelVersion version) throws OperationFailedException {

        ModelNode mainResult = mainServices.executeOperation(operation);
        assertEquals(mainResult.toJSONString(true), SUCCESS, mainResult.get(OUTCOME).asString());

        final OperationTransformer.TransformedOperation op = mainServices.transformOperation(version, operation);
        final ModelNode result = mainServices.executeOperation(version, op);
        assertEquals("should reject the operation", FAILED, result.get(OUTCOME).asString());
    }
 
Example #28
Source File: TruststoreAuthenticationResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public TruststoreAuthenticationResourceDefinition() {
    super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.TRUSTSTORE),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY,
                    "core.management.security-realm.authentication.truststore"))
            .setAddHandler(new SecurityRealmChildAddHandler(true, false, ATTRIBUTE_DEFINITIONS))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(true))
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #29
Source File: SSLServerIdentityResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public SSLServerIdentityResourceDefinition() {
    super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.SERVER_IDENTITY, ModelDescriptionConstants.SSL),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY, "core.management.security-realm.server-identity.ssl"))
            .setAddHandler(new SecurityRealmChildAddHandler(false, false, ATTRIBUTE_DEFINITIONS))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(false))
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #30
Source File: LdapAuthenticationResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public LdapAuthenticationResourceDefinition() {
    super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.AUTHENTICATION, ModelDescriptionConstants.LDAP),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY,
                    "core.management.security-realm.authentication.ldap"))
            .setAddHandler(new LdapAuthenticationAddHandler())
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(true))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}