本文整理汇总了Java中org.apache.directory.api.util.FileUtils类的典型用法代码示例。如果您正苦于以下问题:Java FileUtils类的具体用法?Java FileUtils怎么用?Java FileUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileUtils类属于org.apache.directory.api.util包,在下文中一共展示了FileUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = SchemaManagerLoadTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
// Make sure every test class has its own schema directory
workingDirectory = new File( workingDirectory, "SchemaManagerLoadTest" ).getAbsolutePath();
schemaRepository = new File( workingDirectory, "schema" );
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
}
示例2: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = SchemaManagerDelTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
// Make sure every test class has its own schema directory
workingDirectory = new File( workingDirectory, "SchemaManagerDelTest" ).getAbsolutePath();
schemaRepository = new File( workingDirectory, "schema" );
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
}
示例3: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = SchemaManagerLoadWithDepsTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
// Make sure every test class has its own schema directory
workingDirectory = new File( workingDirectory, "SchemaManagerLoadWithDepsTest" ).getAbsolutePath();
schemaRepository = new File( workingDirectory, "schema" );
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
}
示例4: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = SchemaManagerAddTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
// Make sure every test class has its own schema directory
workingDirectory = new File( workingDirectory, "SchemaManagerAddTest" ).getAbsolutePath();
schemaRepository = new File( workingDirectory, "schema" );
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
}
示例5: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = SchemaManagerEnableDisableLoadTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
// Make sure every test class has its own schema directory
workingDirectory = new File( workingDirectory, "SchemaManagerEnableDisableLoadTest" ).getAbsolutePath();
schemaRepository = new File( workingDirectory, "schema" );
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
}
示例6: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = MatchingRuleTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
schemaRepository = new File( workingDirectory, "schema" );
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
schemaManager = new DefaultSchemaManager( loader );
for ( Schema schema : loader.getAllSchemas() )
{
schema.enable();
}
schemaManager.loadAllEnabled();
}
示例7: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws IOException
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = LdifSchemaLoaderTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
// Cleanup the target directory
FileUtils.deleteDirectory( new File( workingDirectory + "/schema" ) );
}
示例8: setup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws IOException
{
workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
String path = SchemaLdifExtractorTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
// Cleanup the target directory
FileUtils.deleteDirectory( new File( workingDirectory + "/schema" ) );
}
示例9: cleanup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@AfterClass
public static void cleanup() throws IOException
{
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository.getParentFile() );
}
示例10: cleanup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@AfterClass
public static void cleanup() throws IOException
{
// Cleanup the target directory
FileUtils.deleteDirectory( schemaRepository );
}
示例11: cleanup
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@AfterClass
public static void cleanup() throws IOException
{
// Cleanup the target directory
FileUtils.deleteDirectory( new File( workingDirectory + "/schema" ) );
}
示例12: init
import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void init(String name) throws Exception {
if ((directoryService != null) && directoryService.isStarted()) {
return;
}
directoryService.setInstanceId(name);
// instance layout
InstanceLayout instanceLayout = new InstanceLayout(System.getProperty("java.io.tmpdir") + "/server-work-" + name);
if (instanceLayout.getInstanceDirectory().exists()) {
try {
FileUtils.deleteDirectory(instanceLayout.getInstanceDirectory());
} catch (IOException e) {
LOG.warn("couldn't delete the instance directory before initializing the DirectoryService", e);
}
}
directoryService.setInstanceLayout(instanceLayout);
// EhCache in disabled-like-mode
Configuration ehCacheConfig = new Configuration();
CacheConfiguration defaultCache = new CacheConfiguration("default", 1).eternal(false).timeToIdleSeconds(30)
.timeToLiveSeconds(30).overflowToDisk(false);
ehCacheConfig.addDefaultCache(defaultCache);
CacheService cacheService = new CacheService(new CacheManager(ehCacheConfig));
directoryService.setCacheService(cacheService);
// Init the schema
// SchemaLoader loader = new SingleLdifSchemaLoader();
SchemaLoader loader = new JarLdifSchemaLoader();
SchemaManager schemaManager = new DefaultSchemaManager(loader);
schemaManager.loadAllEnabled();
ComparatorRegistry comparatorRegistry = schemaManager.getComparatorRegistry();
for (LdapComparator<?> comparator : comparatorRegistry) {
if (comparator instanceof NormalizingComparator) {
((NormalizingComparator) comparator).setOnServer();
}
}
directoryService.setSchemaManager(schemaManager);
InMemorySchemaPartition inMemorySchemaPartition = new InMemorySchemaPartition(schemaManager);
SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
schemaPartition.setWrappedPartition(inMemorySchemaPartition);
directoryService.setSchemaPartition(schemaPartition);
List<Throwable> errors = schemaManager.getErrors();
if (errors.size() != 0) {
throw new Exception(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
}
// Init system partition
Partition systemPartition = partitionFactory.createPartition(directoryService.getSchemaManager(),
directoryService.getDnFactory(), "system", ServerDNConstants.SYSTEM_DN, 500,
new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "system"));
systemPartition.setSchemaManager(directoryService.getSchemaManager());
partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
directoryService.setSystemPartition(systemPartition);
directoryService.startup();
}