Skip to content

Commit

Permalink
[ELY-2696] Update 3 tests in PrincipalMappingSuiteChild to call a com…
Browse files Browse the repository at this point in the history
…mon method in order to remove duplicated code
  • Loading branch information
map-b committed Oct 26, 2023
1 parent 483aefa commit a5a7458
Showing 1 changed file with 1 addition and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class PrincipalMappingSuiteChild {

@Test
public void testSimpleToDn() throws RealmUnavailableException {
public void testLdapRealmPrincipalMapping() throws RealmUnavailableException {
SecurityRealm realm = LdapSecurityRealmBuilder.builder()
.setDirContextSupplier(LdapTestSuite.dirContextFactory.create())
.identityMapping()
Expand Down Expand Up @@ -68,40 +68,6 @@ public void testDnToSimple() throws RealmUnavailableException {
assertFalse("Exists", identity.exists());
}

@Test
public void testSimpleToSimpleValidate() throws RealmUnavailableException {
SecurityRealm realm = LdapSecurityRealmBuilder.builder()
.setDirContextSupplier(LdapTestSuite.dirContextFactory.create())
.identityMapping()
.setSearchDn("dc=elytron,dc=wildfly,dc=org")
.setRdnIdentifier("uid")
.build()
.build();

RealmIdentity identity = realm.getRealmIdentity(new NamePrincipal("PlainUser"));
assertTrue("Exists", identity.exists());

identity = realm.getRealmIdentity(new NamePrincipal("nobody"));
assertFalse("Exists", identity.exists());
}

@Test
public void testSimpleToSimpleReload() throws RealmUnavailableException {
SecurityRealm realm = LdapSecurityRealmBuilder.builder()
.setDirContextSupplier(LdapTestSuite.dirContextFactory.create())
.identityMapping()
.setSearchDn("dc=elytron,dc=wildfly,dc=org")
.setRdnIdentifier("uid")
.build()
.build();

RealmIdentity identity = realm.getRealmIdentity(new NamePrincipal("PlainUser"));
assertTrue("Exists", identity.exists());

identity = realm.getRealmIdentity(new NamePrincipal("nobody"));
assertFalse("Exists", identity.exists());
}

@Test
public void testDnToDnNoLookup() throws RealmUnavailableException {
SecurityRealm realm = LdapSecurityRealmBuilder.builder()
Expand Down

0 comments on commit a5a7458

Please sign in to comment.