Java Code Examples for org.jboss.as.controller.operations.common.Util#createAddOperation()
The following examples show how to use
org.jboss.as.controller.operations.common.Util#createAddOperation() .
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: CapabilityReloadRequiredUnitTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Before public void setup() throws IOException { ExtensionUtils.createExtensionModule(WFCORE1106, DependentExtension.class); ModelNode addOp = Util.createAddOperation(IFACE); addOp.get(LOOPBACK).set(true); executeOp(addOp); addOp = Util.createAddOperation(SB); addOp.get(INTERFACE).set(WFCORE1106); addOp.get(PORT).set(12345); executeOp(addOp); addOp = Util.createAddOperation(OSB); addOp.get(SOCKET_BINDING_REF).set(WFCORE1106); executeOp(addOp); addOp = Util.createAddOperation(OSB_2); addOp.get(SOCKET_BINDING_REF).set(WFCORE1106); executeOp(addOp); addOp = Util.createAddOperation(EXT); executeOp(addOp); }
Example 2
Source File: SimpleSocketBinding.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void create(ModelControllerClient client, CLIWrapper cli) throws Exception { ModelNode op = Util.createAddOperation( PathAddress.pathAddress().append("socket-binding-group", socketBindingGroup).append("socket-binding", name)); if (!clientMappings.isEmpty()) { ModelNode mappings = op.get("client-mappings"); for (ClientMapping mapping : clientMappings) { mappings.add(mapping.toModelNode()); } } setIfNotNull(op, "fixed-port", fixedPort); setIfNotNull(op, "interface", interfaceName); setIfNotNull(op, "multicast-address", multicastAddress); setIfNotNull(op, "multicast-port", multicastPort); setIfNotNull(op, "port", port); CoreUtils.applyUpdate(op, client); }
Example 3
Source File: LdapRealm.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void create(ModelControllerClient client, CLIWrapper cli) throws Exception { ModelNode op = Util .createAddOperation(PathAddress.pathAddress().append("subsystem", "elytron").append("ldap-realm", name)); op.get("dir-context").set(dirContext); setIfNotNull(op, "allow-blank-password", allowBlankPassword); setIfNotNull(op, "direct-verification", directVerification); setIfNotNull(op, "identity-mapping", identityMapping); CoreUtils.applyUpdate(op, client); }
Example 4
Source File: JmxAuditLogHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private ModelNode createAddFileHandlerOperation(String handlerName, String formatterName, String fileName) { ModelNode op = Util.createAddOperation(createFileHandlerAddress(handlerName)); op.get(ModelDescriptionConstants.RELATIVE_TO).set("log.dir"); op.get(ModelDescriptionConstants.PATH).set(fileName); op.get(ModelDescriptionConstants.FORMATTER).set(formatterName); return op; }
Example 5
Source File: AuditLogXml_Legacy.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void parsePeriodicRotatingFileAuditLogHandler(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException { final ModelNode add = Util.createAddOperation(); list.add(add); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw unexpectedAttribute(reader, i); } final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NAME: add.get(OP_ADDR).set(address).add(ModelDescriptionConstants.PERIODIC_ROTATING_FILE_HANDLER, value); break; case MAX_FAILURE_COUNT: PeriodicRotatingFileAuditLogHandlerResourceDefinition.MAX_FAILURE_COUNT.parseAndSetParameter(value, add, reader); break; case FORMATTER: PeriodicRotatingFileAuditLogHandlerResourceDefinition.FORMATTER.parseAndSetParameter(value, add, reader); break; case PATH: PeriodicRotatingFileAuditLogHandlerResourceDefinition.PATH.parseAndSetParameter(value, add, reader); break; case RELATIVE_TO: PeriodicRotatingFileAuditLogHandlerResourceDefinition.RELATIVE_TO.parseAndSetParameter(value, add, reader); break; case SUFFIX: PeriodicRotatingFileAuditLogHandlerResourceDefinition.SUFFIX.parseAndSetParameter(value, add, reader); break; default: throw unexpectedAttribute(reader, i); } } requireNoContent(reader); }
Example 6
Source File: DomainServerGroupTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testAddServerGroupBadProfile() throws Exception { KernelServices kernelServices = createKernelServices("servergroup.xml"); PathAddress pa = PathAddress.pathAddress(SERVER_GROUP, "group-three"); final ModelNode operation = Util.createAddOperation(pa); operation.get(PROFILE).set("bad-profile"); operation.get(SOCKET_BINDING_GROUP).set("test-sockets"); ModelNode response = kernelServices.executeOperation(operation); Assert.assertEquals(response.toString(), FAILED, response.get(OUTCOME).asString()); Assert.assertTrue(response.toString(), response.get(FAILURE_DESCRIPTION).asString().contains("WFLYCTL0369")); }
Example 7
Source File: AuditLogXml_4.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void parseSyslogAuditLogHandler(final XMLExtendedStreamReader reader, final ModelNode address, final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException { final ModelNode add = Util.createAddOperation(); list.add(add); parseSyslogAuditLogHandlerAttributes(reader, address, add); if (!add.get(OP_ADDR).isDefined()) { throw missingRequired(reader, Collections.singleton(Attribute.NAME)); } boolean protocolSet = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, expectedNs); final Element element = Element.forName(reader.getLocalName()); //Check there is only one protocol if (protocolSet) { throw DomainManagementLogger.ROOT_LOGGER.onlyOneSyslogHandlerProtocol(reader.getLocation()); } protocolSet = true; switch (element) { case UDP: case TCP: case TLS: { parseSyslogAuditLogHandlerProtocol(reader, add.get(OP_ADDR), expectedNs, list, element); break; } default: throw unexpectedElement(reader); } } }
Example 8
Source File: SourceAddressRoleDecoder.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void create(ModelControllerClient client, CLIWrapper cli) throws Exception { ModelNode op = Util.createAddOperation(PATH_ELYTRON.append(SOURCE_ADDRESS_ROLE_DECODER, name)); op.get("source-address").set(ipAddress); op.get("roles").add(role); CoreUtils.applyUpdate(op, client); }
Example 9
Source File: ServerConfigTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testAddServerConfigBadServerGroup() throws Exception { KernelServices kernelServices = createKernelServices("host.xml"); PathAddress pa = PathAddress.pathAddress(PathElement.pathElement(HOST, MASTER), PathElement.pathElement(SERVER_CONFIG, "server-four")); final ModelNode operation = Util.createAddOperation(pa); operation.get(GROUP).set("bad-group"); ModelNode response = kernelServices.executeOperation(operation); Assert.assertEquals(response.toString(), FAILED, response.get(OUTCOME).asString()); Assert.assertTrue(response.toString(), response.get(FAILURE_DESCRIPTION).asString().contains("WFLYCTL0369")); }
Example 10
Source File: AbstractAuditLogHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected ModelNode createAddFileHandlerOperation(String handlerName, String formatterName, String fileName) { ModelNode op = Util.createAddOperation(createFileHandlerAddress(handlerName)); op.get(ModelDescriptionConstants.RELATIVE_TO).set("log.dir"); op.get(ModelDescriptionConstants.PATH).set(fileName); op.get(ModelDescriptionConstants.FORMATTER).set(formatterName); return op; }
Example 11
Source File: DomainSocketBindingGroupTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testBadSocketBindingGroupIncludesAdd() throws Exception { KernelServices kernelServices = createKernelServices(); PathAddress addr = PathAddress.pathAddress(SOCKET_BINDING_GROUP, "bad-add"); ModelNode op = Util.createAddOperation(addr); op.get(DEFAULT_INTERFACE).set("public"); op.get(INCLUDES).add("test").add("NOT_THERE"); ModelNode response = kernelServices.executeOperation(op); Assert.assertEquals(response.toString(), FAILED, response.get(OUTCOME).asString()); Assert.assertTrue(response.toString(), response.get(FAILURE_DESCRIPTION).asString().contains("WFLYCTL0369")); }
Example 12
Source File: SocketBindingGroupIncludesHandlerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testGoodSocketBindingGroupIncludesAdd() throws Exception { PathAddress addr = getSocketBindingGroupAddress("test"); ModelNode op = Util.createAddOperation(addr); op.get(DEFAULT_INTERFACE).set("public"); op.get(INCLUDES).add("binding-one").add("binding-two"); MockOperationContext operationContext = getOperationContext(addr); SocketBindingGroupAddHandler.INSTANCE.execute(operationContext, op); operationContext.executeNextStep(); }
Example 13
Source File: AttributesTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Test public void testObjectReject() throws Exception { final ModelNode object = new ModelNode(); object.get("0").set("zero"); object.get("1").set("one"); object.get("2").set("two"); object.get("3").set("two"); resourceModel.get("reject").set(object.clone()); final RejectTwoChecker checker = new RejectTwoChecker(); Map<String, RejectAttributeChecker> mapChecker = new HashMap<String, RejectAttributeChecker>(); mapChecker.put("1", checker); mapChecker.put("2", checker); final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createInstance(PATH); builder.getAttributeBuilder() .addRejectCheck(new RejectAttributeChecker.ObjectFieldsRejectAttributeChecker(mapChecker), "reject") .end(); TransformationDescription.Tools.register(builder.build(), transformersSubRegistration); final Resource resource = transformResource(); Assert.assertNotNull(resource); final Resource toto = resource.getChild(PATH); Assert.assertNotNull(toto); final ModelNode model = toto.getModel(); //The rejection does not trigger for resource transformation //TODO this could be done if 'slave' is >= 7.2.0 Assert.assertTrue(model.hasDefined("reject")); //The order is unpredicatble since a plain hashmap is used //Assert.assertEquals(2, checker.count); Assert.assertTrue(checker.rejected); checker.count = 0; checker.rejected = false; ModelNode add = Util.createAddOperation(PathAddress.pathAddress(PATH)); add.get("reject").set(object.clone()); OperationTransformer.TransformedOperation transformedAdd = transformOperation(add); Assert.assertTrue(transformedAdd.rejectOperation(success())); //The order is unpredicatble since a plain hashmap is used //Assert.assertEquals(2, checker.count); Assert.assertTrue(checker.rejected); checker.count = 0; checker.rejected = false; ModelNode write = Util.getWriteAttributeOperation(PathAddress.pathAddress(PATH), "reject", object.clone()); OperationTransformer.TransformedOperation transformedWrite = transformOperation(write); Assert.assertTrue(transformedWrite.rejectOperation(success())); //The order is unpredicatble since a plain hashmap is used //Assert.assertEquals(2, checker.count); Assert.assertTrue(checker.rejected); }
Example 14
Source File: LoggingSubsystemParser_3_0.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
void parsePeriodicSizeRotatingHandlerElement(final XMLExtendedStreamReader reader, final PathAddress address, final List<ModelNode> operations, final Set<String> names) throws XMLStreamException { final ModelNode operation = Util.createAddOperation(); // Attributes String name = null; final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); required.remove(attribute); switch (attribute) { case NAME: { name = value; break; } case AUTOFLUSH: { AUTOFLUSH.parseAndSetParameter(value, operation, reader); break; } case ENABLED: ENABLED.parseAndSetParameter(value, operation, reader); break; case ROTATE_ON_BOOT: ROTATE_ON_BOOT.parseAndSetParameter(value, operation, reader); break; default: throw unexpectedAttribute(reader, i); } } if (!required.isEmpty()) { throw missingRequired(reader, required); } if (!names.add(name)) { throw duplicateNamedElement(reader, name); } // Setup the operation address addOperationAddress(operation, address, PeriodicSizeRotatingHandlerResourceDefinition.NAME, name); final EnumSet<Element> requiredElem = EnumSet.of(Element.FILE); final EnumSet<Element> encountered = EnumSet.noneOf(Element.class); while (reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); if (!encountered.add(element)) { throw unexpectedElement(reader); } requiredElem.remove(element); switch (element) { case LEVEL: { LEVEL.parseAndSetParameter(readNameAttribute(reader), operation, reader); break; } case ENCODING: { ENCODING.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case FILTER_SPEC: { PeriodicSizeRotatingHandlerResourceDefinition.FILTER_SPEC.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case FORMATTER: { parseHandlerFormatterElement(reader, operation); break; } case FILE: { parseFileElement(operation.get(FILE.getName()), reader); break; } case APPEND: { APPEND.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case ROTATE_SIZE: { ROTATE_SIZE.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case MAX_BACKUP_INDEX: { MAX_BACKUP_INDEX.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case SUFFIX: { SUFFIX.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } default: { throw unexpectedElement(reader); } } } operations.add(operation); }
Example 15
Source File: LoggingSubsystemParser_3_0.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override void parseSizeRotatingHandlerElement(final XMLExtendedStreamReader reader, final PathAddress address, final List<ModelNode> operations, final Set<String> names) throws XMLStreamException { final ModelNode operation = Util.createAddOperation(); // Attributes String name = null; final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); required.remove(attribute); switch (attribute) { case NAME: { name = value; break; } case AUTOFLUSH: { AUTOFLUSH.parseAndSetParameter(value, operation, reader); break; } case ENABLED: { ENABLED.parseAndSetParameter(value, operation, reader); break; } case ROTATE_ON_BOOT: { ROTATE_ON_BOOT.parseAndSetParameter(value, operation, reader); break; } default: throw unexpectedAttribute(reader, i); } } if (!required.isEmpty()) { throw missingRequired(reader, required); } if (!names.add(name)) { throw duplicateNamedElement(reader, name); } // Setup the operation address addOperationAddress(operation, address, SizeRotatingHandlerResourceDefinition.NAME, name); final EnumSet<Element> requiredElem = EnumSet.of(Element.FILE); final EnumSet<Element> encountered = EnumSet.noneOf(Element.class); while (reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); if (!encountered.add(element)) { throw unexpectedElement(reader); } requiredElem.remove(element); switch (element) { case LEVEL: { LEVEL.parseAndSetParameter(readNameAttribute(reader), operation, reader); break; } case ENCODING: { ENCODING.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case FILTER_SPEC: { SizeRotatingHandlerResourceDefinition.FILTER_SPEC.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case FORMATTER: { parseHandlerFormatterElement(reader, operation); break; } case FILE: { parseFileElement(operation.get(FILE.getName()), reader); break; } case APPEND: { APPEND.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case ROTATE_SIZE: { ROTATE_SIZE.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case MAX_BACKUP_INDEX: { MAX_BACKUP_INDEX.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case SUFFIX: { SizeRotatingHandlerResourceDefinition.SUFFIX.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } default: { throw unexpectedElement(reader); } } } operations.add(operation); }
Example 16
Source File: LoggingSubsystemParser_7_0.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override void parseSyslogHandler(final XMLExtendedStreamReader reader, final PathAddress address, final List<ModelNode> operations, final Set<String> names) throws XMLStreamException { final ModelNode operation = Util.createAddOperation(); // Attributes String name = null; final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); required.remove(attribute); switch (attribute) { case NAME: { name = value; break; } case ENABLED: ENABLED.parseAndSetParameter(value, operation, reader); break; default: throw unexpectedAttribute(reader, i); } } if (!required.isEmpty()) { throw missingRequired(reader, required); } if (!names.add(name)) { throw duplicateNamedElement(reader, name); } // Setup the operation address addOperationAddress(operation, address, SyslogHandlerResourceDefinition.NAME, name); final EnumSet<Element> encountered = EnumSet.noneOf(Element.class); while (reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); if (!encountered.add(element)) { throw unexpectedElement(reader); } switch (element) { case APP_NAME: { APP_NAME.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case FACILITY: { FACILITY.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case HOSTNAME: { HOSTNAME.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case LEVEL: { LEVEL.parseAndSetParameter(readNameAttribute(reader), operation, reader); break; } case FORMATTER: { final EnumSet<Element> requiredFormatter = EnumSet.of(Element.SYSLOG_FORMATTER); while (reader.nextTag() != END_ELEMENT) { switch (Element.forName(reader.getLocalName())) { case SYSLOG_FORMATTER: { requiredFormatter.remove(Element.SYSLOG_FORMATTER); operation.get(SYSLOG_FORMATTER.getName()).set(readStringAttributeElement(reader, Attribute.SYSLOG_TYPE.getLocalName())); break; } case NAMED_FORMATTER: { SyslogHandlerResourceDefinition.NAMED_FORMATTER.parseAndSetParameter(readNameAttribute(reader), operation, reader); break; } default: { throw unexpectedElement(reader); } } } if (!requiredFormatter.isEmpty()) { throw ParseUtils.missingRequiredElement(reader, requiredFormatter); } break; } case PORT: { PORT.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } case SERVER_ADDRESS: { SERVER_ADDRESS.parseAndSetParameter(readValueAttribute(reader), operation, reader); break; } default: { throw unexpectedElement(reader); } } } operations.add(operation); }
Example 17
Source File: ExtensionSubsystemCompositeTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Test public void test() throws IOException { // 1) Sanity check -- subsystem not there ModelNode invokePublic = Util.createEmptyOperation("public", SUBSYSTEM); testBadOp(invokePublic); // 2) sanity check -- subsystem add w/o extension -- fail ModelNode subAdd = Util.createAddOperation(SUBSYSTEM); testBadOp(subAdd); // 3) ext add + sub add + sub other in composite ModelNode extAdd = Util.createAddOperation(EXT); ModelNode goodAdd = buildComposite(extAdd, subAdd, invokePublic); testGoodComposite(goodAdd); // 4) Sanity check -- try invokePublic again outside the composite ModelNode response = executeOp(invokePublic, "success"); assertTrue(response.toString(), response.has("result")); assertTrue(response.toString(), response.get("result").asBoolean()); // 5) sub remove + ext remove + sub add in composite -- fail ModelNode subRemove = Util.createRemoveOperation(SUBSYSTEM); ModelNode extRemove = Util.createRemoveOperation(EXT); ModelNode badRemove = buildComposite(invokePublic, subRemove, extRemove, subAdd); response = testBadOp(badRemove); // But the 'public' op should have worked validateInvokePublicStep(response, 1, true); // 6) sub remove + ext remove in composite ModelNode goodRemove = buildComposite(invokePublic, subRemove, extRemove); response = executeOp(goodRemove, "success"); validateInvokePublicStep(response, 1, false); // 7) confirm ext add + sub add + sub other still works testGoodComposite(goodAdd); // 8) Sanity check -- try invokePublic again outside the composite response = executeOp(invokePublic, "success"); assertTrue(response.toString(), response.has("result")); assertTrue(response.toString(), response.get("result").asBoolean()); }
Example 18
Source File: BasicResourceTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Test public void testDynamicDiscardRedirectOperations() throws Exception { PathAddress subsystem = PathAddress.pathAddress("toto", "testSubsystem"); final PathAddress keepNewAddress = subsystem.append("dynamic-redirect-new", "keep"); final PathAddress keepOriginalAddress = subsystem.append("dynamic-redirect-original", "keep"); final ModelNode opKeep = Util.createAddOperation(keepOriginalAddress); opKeep.get("attribute").set("keep"); OperationTransformer.TransformedOperation txKeep = transformOperation(ModelVersion.create(1), opKeep.clone()); Assert.assertFalse(txKeep.rejectOperation(success())); Assert.assertNotNull(txKeep.getTransformedOperation()); Assert.assertEquals("KEEP", txKeep.getTransformedOperation().get("attribute").asString()); Assert.assertEquals(keepNewAddress, PathAddress.pathAddress(txKeep.getTransformedOperation().get(OP_ADDR))); txKeep = transformOperation(ModelVersion.create(1, 0, 1), opKeep.clone()); Assert.assertFalse(txKeep.rejectOperation(success())); Assert.assertNotNull(txKeep.getTransformedOperation()); Assert.assertEquals("KEEP", txKeep.getTransformedOperation().get("attribute").asString()); Assert.assertEquals(keepNewAddress, PathAddress.pathAddress(txKeep.getTransformedOperation().get(OP_ADDR))); txKeep = transformOperation(ModelVersion.create(1, 0, 5), opKeep.clone()); Assert.assertFalse(txKeep.rejectOperation(success())); Assert.assertNotNull(txKeep.getTransformedOperation()); Assert.assertEquals("KEEP", txKeep.getTransformedOperation().get("attribute").asString()); Assert.assertEquals(keepNewAddress, PathAddress.pathAddress(txKeep.getTransformedOperation().get(OP_ADDR))); txKeep = transformOperation(ModelVersion.create(1, 1), opKeep.clone()); Assert.assertFalse(txKeep.rejectOperation(success())); Assert.assertNotNull(txKeep.getTransformedOperation()); Assert.assertEquals("keep", txKeep.getTransformedOperation().get("attribute").asString()); Assert.assertEquals(keepOriginalAddress, PathAddress.pathAddress(txKeep.getTransformedOperation().get(OP_ADDR))); final ModelNode opDiscard = Util.createAddOperation(subsystem.append("dynamic-redirect-original", "discard")); OperationTransformer.TransformedOperation txDiscard = transformOperation(ModelVersion.create(1), opDiscard.clone()); Assert.assertFalse(txDiscard.rejectOperation(success())); Assert.assertNull(txDiscard.getTransformedOperation()); txDiscard = transformOperation(ModelVersion.create(1, 0, 1), opDiscard.clone()); Assert.assertFalse(txDiscard.rejectOperation(success())); Assert.assertNull(txDiscard.getTransformedOperation()); txDiscard = transformOperation(ModelVersion.create(1, 0, 5), opDiscard.clone()); Assert.assertFalse(txDiscard.rejectOperation(success())); Assert.assertNull(txDiscard.getTransformedOperation()); txDiscard = transformOperation(ModelVersion.create(1, 1), opDiscard.clone()); Assert.assertFalse(txDiscard.rejectOperation(success())); Assert.assertNotNull(txDiscard.getTransformedOperation()); final ModelNode opReject = Util.createAddOperation(subsystem.append("dynamic-redirect-original", "reject")); OperationTransformer.TransformedOperation txReject = transformOperation(ModelVersion.create(1), opReject.clone()); Assert.assertTrue(txReject.rejectOperation(success())); Assert.assertNotNull(txReject.getTransformedOperation()); txReject = transformOperation(ModelVersion.create(1, 0, 1), opReject.clone()); Assert.assertTrue(txReject.rejectOperation(success())); Assert.assertNotNull(txReject.getTransformedOperation()); txReject = transformOperation(ModelVersion.create(1, 0, 5), opReject.clone()); Assert.assertTrue(txReject.rejectOperation(success())); Assert.assertNotNull(txReject.getTransformedOperation()); txReject = transformOperation(ModelVersion.create(1, 1), opReject.clone()); Assert.assertFalse(txReject.rejectOperation(success())); Assert.assertNotNull(txReject.getTransformedOperation()); }
Example 19
Source File: InterdependentDeploymentTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private ModelNode createDeployStep(String name, int inputStreamIndex) { ModelNode result = Util.createAddOperation(PathAddress.pathAddress("deployment", "interrelated-" + name + ".jar")); result.get("enabled").set(true); result.get("content").add().get("input-stream-index").set(inputStreamIndex); return result; }
Example 20
Source File: BindingGroupAddHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
public static ModelNode getOperation(PathAddress address, ModelNode model) { ModelNode op = Util.createAddOperation(address); op.get(DEFAULT_INTERFACE).set(model.get(DEFAULT_INTERFACE)); op.get(PORT_OFFSET).set(model.get(PORT_OFFSET)); return op; }