Skip to content

Commit

Permalink
update AddKeyStoreRealmOnlineTest for WildFly 22
Browse files Browse the repository at this point in the history
WildFly 22+ contains by default "applicationKS" which tests shouldn't (and actually is not able to) remove since it doesn't create it.

```
<key-stores>
    <key-store name="applicationKS">
        <credential-reference clear-text="password"/>
        <implementation type="JKS"/>
        <file path="application.keystore" relative-to="jboss.server.config.dir"/>
    </key-store>
</key-stores>
```
  • Loading branch information
simkam committed Jun 16, 2022
1 parent 7da7d31 commit c96d587
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
import org.wildfly.extras.creaper.commands.elytron.tls.AddKeyStore;
import org.wildfly.extras.creaper.core.CommandFailedException;
import org.wildfly.extras.creaper.core.ServerVersion;
import org.wildfly.extras.creaper.core.online.ModelNodeResult;
import org.wildfly.extras.creaper.core.online.operations.Address;
import org.wildfly.extras.creaper.core.online.operations.OperationException;
import org.wildfly.extras.creaper.core.online.operations.Operations;

import java.io.IOException;
import java.util.List;


@RunWith(Arquillian.class)
Expand All @@ -39,7 +45,9 @@ public void cleanup() throws Exception {
administration.reloadIfRequired();
}

removeAllElytronChildrenType("key-store");
removeKeyStoreIfExists("keyStore1");
removeKeyStoreIfExists("keyStore2");
removeKeyStoreIfExists("TEST_DEFAULT_KEYSTORE_NAME");

administration.reloadIfRequired();
}
Expand Down Expand Up @@ -137,4 +145,10 @@ private void addKeyStore(String keyStoreName) throws CommandFailedException {
.build();
client.apply(addKeyStore);
}

private void removeKeyStoreIfExists(final String keyStoreName) throws IOException, OperationException {
final Operations ops = new Operations(client);
final Address keyStoreAddress = SUBSYSTEM_ADDRESS.and("key-store", keyStoreName);
ops.removeIfExists(keyStoreAddress);
}
}

0 comments on commit c96d587

Please sign in to comment.