本文整理汇总了Java中org.springframework.ldap.test.LdapTestUtils类的典型用法代码示例。如果您正苦于以下问题:Java LdapTestUtils类的具体用法?Java LdapTestUtils怎么用?Java LdapTestUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LdapTestUtils类属于org.springframework.ldap.test包,在下文中一共展示了LdapTestUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startLDAPServer
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@BeforeClass
public static void startLDAPServer() throws Exception {
LdapTestUtils.startApacheDirectoryServer(PORT, baseName.toString(), "test", PRINCIPAL, CREDENTIALS, null);
LdapContextSource contextSource = new LdapContextSource();
contextSource.setUrl("ldap://127.0.0.1:" + PORT);
contextSource.setUserDn("");
contextSource.setPassword("");
contextSource.setPooled(false);
contextSource.afterPropertiesSet();
// Create the Sprint LDAP template
LdapTemplate template = new LdapTemplate(contextSource);
// Clear out any old data - and load the test data
LdapTestUtils.cleanAndSetup(template.getContextSource(), baseName, new ClassPathResource("ldap/testdata.ldif"));
System.out.println("____________Started LDAP_________");
}
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:LDAPIdentityServiceImplTest.java
示例2: loadData
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
protected static void loadData() throws Exception
{
// Bind to the directory
LdapContextSource contextSource = new LdapContextSource();
contextSource.setUrl("ldap://127.0.0.1:10389");
contextSource.setUserDn("uid=admin,ou=system");
contextSource.setPassword("secret");
contextSource.setPooled(false);
//contextSource.setDirObjectFactory(null);
contextSource.afterPropertiesSet();
// Create the Sprint LDAP template
LdapTemplate template = new LdapTemplate(contextSource);
// Clear out any old data - and load the test data
LdapTestUtils.clearSubContexts(contextSource, LdapUtils.newLdapName("dc=example,dc=com"));
LdapTestUtils.loadLdif(contextSource, new ClassPathResource("data.ldif"));
}
开发者ID:geoserver,项目名称:geofence,代码行数:19,代码来源:BaseDAOTest.java
示例3: buildDB
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@Before @Override
public void buildDB() throws Exception {
super.buildDB ();
// Bind to the LDAP directory:
final LdapContextSource contextSource = new LdapContextSource ();
contextSource.setUrl ("ldap://127.0.0.1:" + PORT + "/dc=inspire,dc=idgis,dc=eu");
contextSource.setUserDn (PRINCIPAL);
contextSource.setPassword (CREDENTIALS);
contextSource.setPooled (false);
contextSource.afterPropertiesSet ();
// Create an LDAP template:
ldapTemplate = new LdapTemplate (contextSource);
LdapTestUtils.cleanAndSetup (ldapTemplate.getContextSource (), new DistinguishedName (), new ClassPathResource ("nl/ipo/cds/dao/testdata.ldif"));
((ManagerDaoImpl)managerDao).setLdapTemplate (ldapTemplate);
entityManager.flush ();
}
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:23,代码来源:BaseLdapManagerDaoTest.java
示例4: cleanAndSetup
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@Before
public void cleanAndSetup() throws NamingException, IOException {
Resource ldifResource = getLdifFileResource();
if(!LdapUtils.newLdapName(base).equals(LdapUtils.newLdapName(DEFAULT_BASE))) {
List<String> lines = IOUtils.readLines(ldifResource.getInputStream());
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
for (String line : lines) {
writer.println(StringUtils.replace(line, DEFAULT_BASE, base));
}
writer.flush();
ldifResource = new ByteArrayResource(sw.toString().getBytes("UTF8"));
}
LdapTestUtils.cleanAndSetup(contextSource, getRoot(), ldifResource);
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:19,代码来源:AbstractLdapTemplateIntegrationTest.java
示例5: setUpClass
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception
{
// Start an LDAP server and import test data
// LdapTestUtils.startEmbeddedServer(10389, "", "test");
// LdapTestUtils.startEmbeddedServer(10389, "dc=example,dc=com", "test");
LdapTestUtils.startEmbeddedServer(10389, "dc=com", "test");
loadData();
}
开发者ID:geoserver,项目名称:geofence,代码行数:10,代码来源:BaseDAOTest.java
示例6: setUpClass
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
// Added because the close down of Apache DS on Linux does
// not seem to free up its port.
port=GetFreePort.getFreePort();
commonFlags=new String[] {
"--url", "ldap://127.0.0.1:"+port,
"--username", "",
"--password", "",
"--error"};
// Start an in process LDAP server
LdapTestUtils.startEmbeddedServer(port, baseName.toString(), "odm-test");
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:16,代码来源:TestSchemaViewer.java
示例7: setUpClass
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
// Added because the close down of Apache DS on Linux does
// not seem to free up its port.
port=GetFreePort.getFreePort();
// Start an in process LDAP server
LdapTestUtils.startEmbeddedServer(port, baseName.toString(), "odm-test");
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:10,代码来源:TestSchemaToJava.java
示例8: setUp
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
// Create some basic converters and a converter manager
converterManager = new ConverterManagerImpl();
Converter ptc = new FromStringConverter();
converterManager.addConverter(String.class, "", Byte.class, ptc);
converterManager.addConverter(String.class, "", Short.class, ptc);
converterManager.addConverter(String.class, "", Integer.class, ptc);
converterManager.addConverter(String.class, "", Long.class, ptc);
converterManager.addConverter(String.class, "", Double.class, ptc);
converterManager.addConverter(String.class, "", Float.class, ptc);
converterManager.addConverter(String.class, "", Boolean.class, ptc);
Converter tsc = new ToStringConverter();
converterManager.addConverter(Byte.class, "", String.class, tsc);
converterManager.addConverter(Short.class, "", String.class, tsc);
converterManager.addConverter(Integer.class, "", String.class, tsc);
converterManager.addConverter(Long.class, "", String.class, tsc);
converterManager.addConverter(Double.class, "", String.class, tsc);
converterManager.addConverter(Float.class, "", String.class, tsc);
converterManager.addConverter(Boolean.class, "", String.class, tsc);
// Bind to the directory
contextSource = new LdapContextSource();
contextSource.setUrl("ldap://127.0.0.1:" + port);
contextSource.setUserDn("");
contextSource.setPassword("");
contextSource.setPooled(false);
contextSource.afterPropertiesSet();
// Clear out any old data - and load the test data
LdapTestUtils.cleanAndSetup(contextSource, baseName, new ClassPathResource("testdata.ldif"));
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:35,代码来源:TestSchemaToJava.java
示例9: tearDown
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
LdapTestUtils.shutdownEmbeddedServer();
contextSource=null;
converterManager=null;
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:8,代码来源:TestSchemaToJava.java
示例10: setUpClass
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
// Added because the close down of Apache DS on Linux does
// not seem to free up its port.
port=GetFreePort.getFreePort();
// Start an LDAP server and import test data
LdapTestUtils.startEmbeddedServer(port, baseName.toString(), "odm-test");
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:10,代码来源:TestLdap.java
示例11: setUp
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
public void setUp(String url, String username, String password) throws Exception {
// Create some basic converters and a converter manager
converterManager = new ConverterManagerImpl();
Converter ptc = new FromStringConverter();
converterManager.addConverter(String.class, "", Byte.class, ptc);
converterManager.addConverter(String.class, "", Short.class, ptc);
converterManager.addConverter(String.class, "", Integer.class, ptc);
converterManager.addConverter(String.class, "", Long.class, ptc);
converterManager.addConverter(String.class, "", Double.class, ptc);
converterManager.addConverter(String.class, "", Float.class, ptc);
converterManager.addConverter(String.class, "", Boolean.class, ptc);
Converter tsc = new ToStringConverter();
converterManager.addConverter(Byte.class, "", String.class, tsc);
converterManager.addConverter(Short.class, "", String.class, tsc);
converterManager.addConverter(Integer.class, "", String.class, tsc);
converterManager.addConverter(Long.class, "", String.class, tsc);
converterManager.addConverter(Double.class, "", String.class, tsc);
converterManager.addConverter(Float.class, "", String.class, tsc);
converterManager.addConverter(Boolean.class, "", String.class, tsc);
// Bind to the directory
contextSource = getContextSource(url, username, password);
// Clear out any old data - and load the test data
LdapTestUtils.cleanAndSetup(contextSource, baseName, new ClassPathResource("testdata.ldif"));
// Create our OdmManager
Set<Class<?>> managedClasses=new HashSet<Class<?>>();
managedClasses.add(Person.class);
managedClasses.add(PlainPerson.class);
managedClasses.add(OrganizationalUnit.class);
odmManager = new OdmManagerImpl(converterManager, contextSource, managedClasses);
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:36,代码来源:TestLdap.java
示例12: tearDown
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
LdapTestUtils.clearSubContexts(contextSource, baseName);
odmManager=null;
contextSource=null;
converterManager=null;
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:9,代码来源:TestLdap.java
示例13: verifyThatInvalidConnectionIsAutomaticallyPurged
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
/**
* This method depends on a DirObjectFactory (
* {@link org.springframework.ldap.core.support.DefaultDirObjectFactory})
* being set in the ContextSource.
*/
@Test
public void verifyThatInvalidConnectionIsAutomaticallyPurged() throws Exception {
LdapTestUtils.startEmbeddedServer(1888, "dc=261consulting,dc=com", "jayway");
LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif"));
DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,ou=Sweden");
assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2");
assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
assertThat(result.getStringAttribute("description")).isEqualTo("Sweden, Company1, Some Person2");
// Shutdown server and kill all existing connections
LdapTestUtils.shutdownEmbeddedServer();
LdapTestUtils.startEmbeddedServer(1888, "dc=261consulting,dc=com", "jayway");
try {
tested.lookup("cn=Some Person2, ou=company1,ou=Sweden");
fail("Exception expected");
} catch (Exception expected) {
// This should fail because the target connection was closed
assertThat(true).isTrue();
}
LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif"));
// But this should be OK, because the dirty connection should have been automatically purged.
tested.lookup("cn=Some Person2, ou=company1,ou=Sweden");
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:32,代码来源:LdapTemplatePooledITest.java
示例14: prepareTestedData
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@Before
public void prepareTestedData() throws IOException, NamingException {
LdapTestUtils.cleanAndSetup(
contextSource,
LdapUtils.newLdapName("ou=People"),
new ClassPathResource("/setup_data.ldif"));
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:8,代码来源:PagedSearchITest.java
示例15: prepareTestedInstance
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@Before
public void prepareTestedInstance() throws Exception {
LdapTestUtils.cleanAndSetup(
contextSource,
LdapUtils.newLdapName("ou=People"),
new ClassPathResource("/setup_data.ldif"));
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:8,代码来源:DigestMd5AuthenticationITest.java
示例16: prepareTestedInstance
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@Before
public void prepareTestedInstance() throws Exception {
LdapTestUtils.cleanAndSetup(
contextSource,
LdapUtils.newLdapName("ou=People"),
new ClassPathResource("/setup_data.ldif"));
attributesMapper = new AttributeCheckAttributesMapper();
contextMapper = new AttributeCheckContextMapper();
}
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:11,代码来源:LdapTemplateSearchResultITest.java
示例17: shutdownLDAP
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@AfterClass
public static void shutdownLDAP() throws Exception {
LdapTestUtils.destroyApacheDirectoryServer(PRINCIPAL, CREDENTIALS);
System.out.println("____________Shutdown LDAP_________");
}
开发者ID:kuali,项目名称:kc-rice,代码行数:6,代码来源:LDAPIdentityServiceImplTest.java
示例18: tearDownClass
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@AfterClass
public static void tearDownClass() throws Exception
{
LdapTestUtils.shutdownEmbeddedServer();
}
开发者ID:geoserver,项目名称:geofence,代码行数:6,代码来源:BaseDAOTest.java
示例19: setUpClass
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@BeforeClass
public static void setUpClass () throws Exception {
LdapTestUtils.startApacheDirectoryServer (PORT, BASE_NAME.toString (), "odm-test", PRINCIPAL, CREDENTIALS);
}
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:5,代码来源:BaseLdapManagerDaoTest.java
示例20: tearDownClass
import org.springframework.ldap.test.LdapTestUtils; //导入依赖的package包/类
@AfterClass
public static void tearDownClass () throws Exception {
LdapTestUtils.destroyApacheDirectoryServer (PRINCIPAL, CREDENTIALS);
}
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:5,代码来源:BaseLdapManagerDaoTest.java
注:本文中的org.springframework.ldap.test.LdapTestUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论