Search in sources :

Example 1 with TransformedOperation

use of org.jboss.as.controller.transform.OperationTransformer.TransformedOperation in project wildfly by wildfly.

the class WebSubsystemTestCase method checkUndefinedCipherSuite.

private void checkUndefinedCipherSuite(KernelServices services, ModelVersion version) throws Exception {
    final ModelNode success = new ModelNode();
    success.get(ModelDescriptionConstants.OUTCOME).set(ModelDescriptionConstants.SUCCESS);
    success.get(ModelDescriptionConstants.RESULT);
    success.protect();
    PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, getMainSubsystemName()), PathElement.pathElement("connector", "https"), PathElement.pathElement("configuration", "ssl"));
    ModelNode op = Util.createOperation(WRITE_ATTRIBUTE_OPERATION, addr);
    op.get(NAME).set("cipher-suite");
    op.get(VALUE).set(new ModelNode());
    TransformedOperation transOp = services.transformOperation(version, op);
    Assert.assertTrue(transOp.rejectOperation(success));
    op.get(VALUE).set("SSL_RSA_WITH_3DES_EDE_CBC_SHA");
    transOp = services.transformOperation(version, op);
    Assert.assertFalse(transOp.rejectOperation(success));
}
Also used : TransformedOperation(org.jboss.as.controller.transform.OperationTransformer.TransformedOperation) PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode)

Example 2 with TransformedOperation

use of org.jboss.as.controller.transform.OperationTransformer.TransformedOperation in project wildfly by wildfly.

the class JGroupsTransformersTestCase method testNonMapTransformersWork.

private void testNonMapTransformersWork(KernelServices services, ModelVersion version) throws Exception {
    final PathAddress stackAddr = PathAddress.pathAddress(SUBSYSTEM, getMainSubsystemName()).append("stack", "test");
    ModelNode addStack = Util.createAddOperation(stackAddr);
    executeOpInBothControllersWithAttachments(services, version, addStack);
    final PathAddress transportAddr = stackAddr.append("transport", "tcp");
    ModelNode addTransport = Util.createAddOperation(transportAddr);
    addTransport.get(SocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING.getName()).set("some-binding");
    addTransport.get(MODULE).set("do.reject");
    TransformedOperation op = services.executeInMainAndGetTheTransformedOperation(addTransport, version);
    Assert.assertTrue(op.rejectOperation(success()));
    final PathAddress protocolAddr = stackAddr.append("protocol", "PING");
    ModelNode addProtocol = Util.createAddOperation(protocolAddr);
    addProtocol.get(MODULE).set("do.reject");
    op = services.executeInMainAndGetTheTransformedOperation(addProtocol, version);
    Assert.assertTrue(op.rejectOperation(success()));
    op = services.executeInMainAndGetTheTransformedOperation(Util.getWriteAttributeOperation(transportAddr, MODULE, "reject.this"), version);
    Assert.assertTrue(op.rejectOperation(success()));
    op = services.executeInMainAndGetTheTransformedOperation(Util.getWriteAttributeOperation(protocolAddr, MODULE, "reject.this"), version);
    Assert.assertTrue(op.rejectOperation(success()));
}
Also used : TransformedOperation(org.jboss.as.controller.transform.OperationTransformer.TransformedOperation) PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode)

Example 3 with TransformedOperation

use of org.jboss.as.controller.transform.OperationTransformer.TransformedOperation in project wildfly by wildfly.

the class IDMSubsystem_1_0_TransformerUnitTestCase method testRejectionExpressions.

private void testRejectionExpressions(ModelTestControllerVersion controllerVersion, String picketLinkJBossAs7Version) throws Exception {
    ModelVersion oldVersion = ModelVersion.create(1, 0, 0);
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, oldVersion).setExtensionClassName(IDMExtension.class.getName()).addMavenResourceURL("org.wildfly:wildfly-picketlink:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL("org.picketlink.distribution:picketlink-jbas7:" + picketLinkJBossAs7Version).dontPersistXml();
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(oldVersion);
    Assert.assertNotNull(legacyServices);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    ModelNode op = createOperation(ADD, ModelElement.PARTITION_MANAGER.getName(), "test.partition", ModelElement.IDENTITY_CONFIGURATION.getName(), "test.config", ModelElement.LDAP_STORE.getName(), "ldap-store");
    op.get(ModelElement.LDAP_STORE_ACTIVE_DIRECTORY.getName()).set(true);
    TransformedOperation transformedOperation = mainServices.transformOperation(oldVersion, op);
    Assert.assertTrue(transformedOperation.rejectOperation(null));
    op = createOperation(ADD, ModelElement.PARTITION_MANAGER.getName(), "test.partition", ModelElement.IDENTITY_CONFIGURATION.getName(), "test.config", ModelElement.LDAP_STORE.getName(), "ldap-store");
    op.get(ModelElement.LDAP_STORE_UNIQUE_ID_ATTRIBUTE_NAME.getName()).set("SOMEaTTRIBUTE");
    transformedOperation = mainServices.transformOperation(oldVersion, op);
    Assert.assertTrue(transformedOperation.rejectOperation(null));
}
Also used : TransformedOperation(org.jboss.as.controller.transform.OperationTransformer.TransformedOperation) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Aggregations

TransformedOperation (org.jboss.as.controller.transform.OperationTransformer.TransformedOperation)3 ModelNode (org.jboss.dmr.ModelNode)3 PathAddress (org.jboss.as.controller.PathAddress)2 ModelVersion (org.jboss.as.controller.ModelVersion)1 KernelServices (org.jboss.as.subsystem.test.KernelServices)1 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)1