ModelNode connectorAdd = createOperation(ADD, SUBSYSTEM, WebExtension.SUBSYSTEM_NAME, Constants.CONNECTOR, "test");
for (String key : connectorValues.keys()) {
connectorAdd.get(key).set(connectorValues.get(key));
}
checkOutcome(mainServices.executeOperation(connectorAdd));
TransformedOperation transOp = mainServices.transformOperation(modelVersion, connectorAdd);
result = mainServices.executeOperation(modelVersion, transOp);
if (modelVersion.getMicro() == 0) {
Assert.assertEquals(FAILED, result.get(OUTCOME).asString());
Assert.assertTrue(result.get(FAILURE_DESCRIPTION).asString().endsWith(WebMessages.MESSAGES.transformationVersion_1_1_0_JBPAPP_9314()));
} else {
checkOutcome(result);
}
//End - This section tests stuff that was fixed in version 1.1.1
//Now test the correction of the default redirect-port
// First, in add
connectorAdd = createOperation(ADD, SUBSYSTEM, WebExtension.SUBSYSTEM_NAME, Constants.CONNECTOR, "as75871");
for (String key : connectorValues.keys()) {
if (!key.equals(REDIRECT_PORT) && !key.equals(VIRTUAL_SERVER)) {
connectorAdd.get(key).set(connectorValues.get(key));
}
}
Assert.assertFalse(connectorAdd.hasDefined(REDIRECT_PORT));
checkOutcome(mainServices.executeOperation(connectorAdd));
transOp = mainServices.transformOperation(modelVersion, connectorAdd);
Assert.assertTrue(transOp.getTransformedOperation().hasDefined(REDIRECT_PORT));
Assert.assertEquals(443, transOp.getTransformedOperation().get(REDIRECT_PORT).asInt());
checkOutcome(mainServices.executeOperation(modelVersion, transOp));
ModelNode transformed = mainServices.readTransformedModel(modelVersion).get(SUBSYSTEM, WebExtension.SUBSYSTEM_NAME, CONNECTOR, "as75871");
Assert.assertTrue(transformed.hasDefined(REDIRECT_PORT));
Assert.assertEquals(443, transformed.get(REDIRECT_PORT).asInt());
// Next, in a write-attribute setting to undefined
ModelNode write = createOperation(WRITE_ATTRIBUTE_OPERATION, SUBSYSTEM, WebExtension.SUBSYSTEM_NAME, Constants.CONNECTOR, "as75871");
write.get(NAME).set(REDIRECT_PORT);
write.get(VALUE);
transOp = mainServices.transformOperation(modelVersion, write);
ModelNode translatedWrite = transOp.getTransformedOperation();
Assert.assertTrue(translatedWrite.hasDefined(VALUE));
Assert.assertEquals(443, translatedWrite.get(VALUE).asInt());
checkOutcome(mainServices.executeOperation(modelVersion, transOp));
transformed = mainServices.readTransformedModel(modelVersion).get(SUBSYSTEM, WebExtension.SUBSYSTEM_NAME, CONNECTOR, "as75871");
Assert.assertTrue(transformed.hasDefined(REDIRECT_PORT));
Assert.assertEquals(443, transformed.get(REDIRECT_PORT).asInt());
// Finally, test undefine-attribute translating to write-attribute
ModelNode undefine = createOperation(UNDEFINE_ATTRIBUTE_OPERATION, SUBSYSTEM, WebExtension.SUBSYSTEM_NAME, Constants.CONNECTOR, "as75871");
undefine.get(NAME).set(REDIRECT_PORT);
transOp = mainServices.transformOperation(modelVersion, undefine);
Assert.assertEquals(translatedWrite, transOp.getTransformedOperation());
checkOutcome(mainServices.executeOperation(modelVersion, transOp));
transformed = mainServices.readTransformedModel(modelVersion).get(SUBSYSTEM, WebExtension.SUBSYSTEM_NAME, CONNECTOR, "as75871");
Assert.assertTrue(transformed.hasDefined(REDIRECT_PORT));
Assert.assertEquals(443, transformed.get(REDIRECT_PORT).asInt());
}