@Test public void testGetPrimaryEntitiesNegativeStart() { LDAPConfiguration ldapCfg = Configuration.getInstance().getLDAPConfiguration(); ldapCfg.setMapping(LDAPConfiguration.LDAP_MAPPING_ID, "uid"); LDAPDataProvider dp = new LDAPDataProvider(); users = dp.getPrimaryEntities(null, null, -1, 5, null); assertEquals(5, users.size()); first = users.get(0); last = users.get(users.size() - 1); assertEquals("bjensen", first.getId()); assertEquals("ahall", last.getId()); }
@Test public void testGetPrimaryEntitiesBiggerPage() { LDAPConfiguration ldapCfg = Configuration.getInstance().getLDAPConfiguration(); ldapCfg.setMapping(LDAPConfiguration.LDAP_MAPPING_ID, "uid"); LDAPDataProvider dp = new LDAPDataProvider(); users = dp.getPrimaryEntities(null, null, 0, 20, null); assertEquals(12, users.size()); first = users.get(0); last = users.get(users.size() - 1); assertEquals("bjensen", first.getId()); assertEquals("ashelton", last.getId()); }
@Test public void testGetPrimaryEntitiesMaxPageSize() { Configuration cfg = Configuration.getInstance(); LDAPConfiguration ldapCfg = Configuration.getInstance().getLDAPConfiguration(); ldapCfg.setMapping(LDAPConfiguration.LDAP_MAPPING_ID, "uid"); ldapCfg.setMaxPageSize(8); LDAPDataProvider dp = new LDAPDataProvider(); users = dp.getPrimaryEntities(null, null, 0, 10000, null); assertEquals(8, users.size()); first = users.get(0); last = users.get(users.size() - 1); assertEquals("bjensen", first.getId()); assertEquals("ajensen", last.getId()); // Reset to default cfg.getLDAPConfiguration().setMaxPageSize(0); }
@Test public void testGetPrimaryEntitiesNegativePageSize() { Configuration cfg = Configuration.getInstance(); LDAPConfiguration ldapCfg = cfg.getLDAPConfiguration(); ldapCfg.setMaxPageSize(5); ldapCfg.setMapping(LDAPConfiguration.LDAP_MAPPING_ID, "uid"); LDAPDataProvider dp = new LDAPDataProvider(); users = dp.getPrimaryEntities(null, null, 10, -1, null); assertEquals(2, users.size()); first = users.get(0); last = users.get(users.size() - 1); assertEquals("alutz", first.getId()); assertEquals("ashelton", last.getId()); // Reset to default cfg.getLDAPConfiguration().setMaxPageSize(0); }