Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HAL-1593] Test for certificate authority configuration #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ public class ElytronOtherSettingsPage extends BasePage {
@FindBy(id = ELYTRON_DIR_CONTEXT + "-" + CREDENTIAL_REFERENCE + "-" + FORM) private FormFragment dirContextCredentialReferenceForm;
@FindBy(id = ELYTRON_DIR_CONTEXT + "-" + TAB_CONTAINER) private TabsFragment dirContextTabs;

@FindBy(id = ELYTRON_CERTIFICATE_AUTHORITY + "-" + TABLE + WRAPPER)
private TableFragment certificateAuthorityTable;

@FindBy(id = ELYTRON_CERTIFICATE_AUTHORITY + "-" + FORM)
private FormFragment certificateAuthorityForm;

@FindBy(id = ELYTRON_CERTIFICATE_AUTHORITY_ACCOUNT + "-" + TABLE + WRAPPER)
private TableFragment certificateAuthorityAccountTable;

Expand Down Expand Up @@ -420,6 +426,14 @@ public TabsFragment getDirContextTabs() {
return dirContextTabs;
}

public TableFragment getCertificateAuthorityTable() {
return certificateAuthorityTable;
}

public FormFragment getCertificateAuthorityForm() {
return certificateAuthorityForm;
}

public TableFragment getCertificateAuthorityAccountTable() {
return certificateAuthorityAccountTable;
}
Expand Down Expand Up @@ -465,4 +479,4 @@ public TableFragment getServerSSLSNIContextTable() {
public FormFragment getServerSSLSNIContextForm() {
return serverSSLSNIContextForm;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public final class ElytronFixtures {
public static final String CACHING_REALM_ITEM = "elytron-caching-realm-item";
public static final String CERTIFICATE_FROM = "certificate-from";
public static final String CERTIFICATE_AUTHORITY_ACCOUNT_ITEM = "elytron-certificate-authority-account-item";
public static final String CERTIFICATE_AUTHORITY_ITEM = "elytron-certificate-authority-item";
public static final String CERTIFICATE_REVOCATION_LIST = "certificate-revocation-list";
public static final String CHAINED_PRINCIPAL_TRANSFORMER_ITEM = Ids.build(ELYTRON_CHAINED_PRINCIPAL_TRANSFORMER, ITEM);
public static final String CLEAR_PASSWORD_MAPPER = "clear-password-mapper";
Expand Down Expand Up @@ -1248,6 +1249,10 @@ public static Address certificateAuthorityAccountAddress(String name) {
return SUBSYSTEM_ADDRESS.and("certificate-authority-account", name);
}

public static Address certificateAuthorityAddress(String name) {
return SUBSYSTEM_ADDRESS.and("certificate-authority", name);
}

// ------------- mapped-role-mapper

public static Address mappedRoleMapperAddress(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package org.jboss.hal.testsuite.test.configuration.elytron.other.settings.certificate.authority.account;

import java.io.IOException;

import org.jboss.arquillian.junit.Arquillian;
import org.jboss.hal.dmr.ModelDescriptionConstants;
import org.jboss.hal.testsuite.Random;
import org.jboss.hal.testsuite.test.configuration.elytron.ElytronFixtures;
import org.jboss.hal.testsuite.test.configuration.elytron.other.settings.AbstractOtherSettingsTest;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.wildfly.extras.creaper.core.online.operations.OperationException;
import org.wildfly.extras.creaper.core.online.operations.Values;

@RunWith(Arquillian.class)
public class CertificateAuthorityTest extends AbstractOtherSettingsTest {

private static final String CERTIFICATE_AUTHORITY_CREATE =
"certificate-authority-to-be-created-" + Random.name();

private static final String CERTIFICATE_AUTHORITY_UPDATE =
"certificate-authority-to-be-updated-" + Random.name();

private static final String CERTIFICATE_AUTHORITY_DELETE =
"certificate-authority-to-be-deleted-" + Random.name();

private static final String LOCALHOST = "http://localhost";


@BeforeClass
public static void initResources() throws IOException {
operations.add(ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_UPDATE), Values.of(ModelDescriptionConstants.URL, LOCALHOST));
operations.add(ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_DELETE), Values.of(ModelDescriptionConstants.URL, LOCALHOST));
}

@AfterClass
public static void cleanUp() throws IOException, OperationException {
operations.removeIfExists(
ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_CREATE));
operations.removeIfExists(
ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_UPDATE));
operations.removeIfExists(
ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_DELETE));
}

@Before
public void navigateToCertificateAuthority() {
console.verticalNavigation()
.selectSecondary(ElytronFixtures.OTHER_ITEM, ElytronFixtures.CERTIFICATE_AUTHORITY_ITEM);
}

@Test
public void create() throws Exception {
crud.create(ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_CREATE),
page.getCertificateAuthorityTable(), formFragment -> {
formFragment.text("name", CERTIFICATE_AUTHORITY_CREATE);
formFragment.text(ModelDescriptionConstants.URL, LOCALHOST);
});
}

@Test
public void delete() throws Exception {
crud.delete(ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_DELETE),
page.getCertificateAuthorityTable(), CERTIFICATE_AUTHORITY_DELETE);
}

@Test
public void editUrl() throws Exception {
page.getCertificateAuthorityTable().select(CERTIFICATE_AUTHORITY_UPDATE);
crud.update(ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_UPDATE),
page.getCertificateAuthorityForm(), ModelDescriptionConstants.URL, "https://example.com");
}


@Test
public void editStagingUrl() throws Exception {
page.getCertificateAuthorityTable().select(CERTIFICATE_AUTHORITY_UPDATE);
crud.update(ElytronFixtures.certificateAuthorityAddress(CERTIFICATE_AUTHORITY_UPDATE),
page.getCertificateAuthorityForm(), "staging-url", "https://example.com");
}


}