forked from wildfly/wildfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wildfly#17693 from xstefank/WFLY-19098
WFLY-19098 galleon: custom provisioning creates unsecured http-invoker
- Loading branch information
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
.../test/java/org/jboss/as/test/smoke/web/httpinvoker/HTTPInvokerSecuredElytronTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.jboss.as.test.smoke.web.httpinvoker; | ||
|
||
import org.jboss.dmr.ModelNode; | ||
import org.junit.Assert; | ||
|
||
public class HTTPInvokerSecuredElytronTestCase extends HTTPInvokerSecuredTestCase { | ||
|
||
@Override | ||
protected void validateOperation(ModelNode operationResult) { | ||
Assert.assertEquals("The http-authentication-factory should be set", | ||
"application-http-authentication", operationResult.get("http-authentication-factory").asString()); | ||
Assert.assertFalse("The security-realm should be undefined", | ||
operationResult.get("security-realm").isDefined()); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...web/src/test/java/org/jboss/as/test/smoke/web/httpinvoker/HTTPInvokerSecuredTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.jboss.as.test.smoke.web.httpinvoker; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.as.arquillian.api.ContainerResource; | ||
import org.jboss.as.arquillian.container.ManagementClient; | ||
import org.jboss.as.controller.client.helpers.Operations; | ||
import org.jboss.as.controller.descriptions.ModelDescriptionConstants; | ||
import org.jboss.dmr.ModelNode; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Arquillian.class) | ||
@RunAsClient | ||
public abstract class HTTPInvokerSecuredTestCase { | ||
|
||
@Deployment | ||
public static Archive<?> getDeployment() { | ||
return ShrinkWrap.create(WebArchive.class, "httpinvoker.war"); | ||
} | ||
|
||
@Test | ||
public void testHttpInvokerConfiguration(@ContainerResource ManagementClient managementClient) throws Exception { | ||
final ModelNode address = new ModelNode(); | ||
address.add(ModelDescriptionConstants.SUBSYSTEM, "undertow"); | ||
address.add(ModelDescriptionConstants.SERVER, "default-server"); | ||
address.add(ModelDescriptionConstants.HOST, "default-host"); | ||
address.add("setting", "http-invoker"); | ||
|
||
final ModelNode operation = new ModelNode(); | ||
operation.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.READ_RESOURCE_OPERATION); | ||
operation.get(ModelDescriptionConstants.OP_ADDR).set(address); | ||
|
||
final ModelNode result = managementClient.getControllerClient().execute(operation); | ||
Assert.assertTrue("Failure to read http-invoker resource: " + result.toString(), | ||
Operations.isSuccessfulOutcome(result)); | ||
|
||
final ModelNode operationResult = result.get(ModelDescriptionConstants.RESULT); | ||
validateOperation(operationResult); | ||
} | ||
|
||
protected abstract void validateOperation(ModelNode operationResult); | ||
} |