/** * Get the Alfresco temp dir, by defaut %java.io.tempdir%/Alfresco. * Will create the temp dir on the fly if it does not already exist. * * @return Returns a temporary directory, i.e. <code>isDir == true</code> */ public static File getTempDir() { return getTempDir(ALFRESCO_TEMP_FILE_DIR); }
/** * Get the Alfresco temp dir, by defaut %java.io.tempdir%/Alfresco. * Will create the temp dir on the fly if it does not already exist. * * @return Returns a temporary directory, i.e. <code>isDir == true</code> */ public static File getTempDir() { return getTempDir(ALFRESCO_TEMP_FILE_DIR); }
public void setup() { File tempDir = TempFileProvider.getTempDir(); this.tmp = new File(tempDir, "CMISAppend"); if(!this.tmp.exists() && !this.tmp.mkdir()) { throw new AlfrescoRuntimeException("Failed to create CMIS temporary directory"); } }
public void setup() { File tempDir = TempFileProvider.getTempDir(); this.tmp = new File(tempDir, "CMISAppend"); if(!this.tmp.exists() && !this.tmp.mkdir()) { throw new AlfrescoRuntimeException("Failed to create CMIS temporary directory"); } }
/** * Removes all temporary files created before the given time. * <p> * The delete will cascade down through directories as well. * * @param removeBefore only remove files created <b>before</b> this time * @return Returns the number of files removed */ public static int removeFiles(long removeBefore) { File tempDir = TempFileProvider.getTempDir(); return removeFiles(tempDir, removeBefore, removeBefore, false); }
/** * Removes all temporary files created before the given time. * <p> * The delete will cascade down through directories as well. * * @param removeBefore only remove files created <b>before</b> this time * @return Returns the number of files removed */ public static int removeFiles(long removeBefore) { File tempDir = TempFileProvider.getTempDir(); return removeFiles(tempDir, removeBefore, removeBefore, false); }
/** * Create a temp file in the alfresco temp dir. * * @return Returns a temp <code>File</code> that will be located in the * <b>Alfresco</b> subdirectory of the default temp directory * * @see #ALFRESCO_TEMP_FILE_DIR * @see File#createTempFile(java.lang.String, java.lang.String) */ public static File createTempFile(String prefix, String suffix) { File tempDir = TempFileProvider.getTempDir(); // we have the directory we want to use return createTempFile(prefix, suffix, tempDir); }
/** * Create a temp file in the alfresco temp dir. * * @return Returns a temp <code>File</code> that will be located in the * <b>Alfresco</b> subdirectory of the default temp directory * * @see #ALFRESCO_TEMP_FILE_DIR * @see File#createTempFile(java.lang.String, java.lang.String) */ public static File createTempFile(String prefix, String suffix) { File tempDir = TempFileProvider.getTempDir(); // we have the directory we want to use return createTempFile(prefix, suffix, tempDir); }
@Test(expected=IllegalArgumentException.class) public void exceptionThrownWhenZeroPrefixesUsed() { // Shouldn't be able to construct a dumper with no prefixes to dump. new MultiFileDumper(new String[] {}, TempFileProvider.getTempDir(), "", dbToXMLFactory, null); }
@Override public void setUp() throws Exception { ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); transactionService = serviceRegistry.getTransactionService(); txnHelper = transactionService.getRetryingTransactionHelper(); contentDataDAO = (ContentDataDAO) ctx.getBean("contentDataDAO"); contentStore = new FileContentStore(ctx, TempFileProvider.getTempDir()); }
@Test(expected=IllegalArgumentException.class) public void exceptionThrownWhenNullPrefixListUsed() { // Shouldn't be able to construct a dumper with no prefixes to dump. new MultiFileDumper(null, TempFileProvider.getTempDir(), "", dbToXMLFactory, null); }
@Test public void execute() { ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(); File outFile = new File(TempFileProvider.getTempDir(), getClass().getSimpleName() + ".xml"); System.out.println("Writing to temp file: " + outFile); DbToXML dbToXML = new DbToXML(ctx, outFile); dbToXML.execute(); } }
public void setUp() throws Exception { ctx = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS); File tempDir = new File(TempFileProvider.getTempDir(), GUID.generate()); this.streamFactory = TempStoreOutputStreamFactory.newInstance(tempDir, 1024, 1024, false); this.eventPublisher = (EventPublisherForTestingOnly) ctx.getBean("eventPublisher"); }
/** * Service initialise */ public void init() { // Set up a temporary store this.tempStore = new FileContentStore(this.applicationContext, TempFileProvider.getTempDir().getAbsolutePath()); // Bind on update properties behaviour this.policyComponent.bindClassBehaviour( NodeServicePolicies.OnUpdatePropertiesPolicy.QNAME, this, new JavaBehaviour(this, "onUpdateProperties")); // Register on content update policy this.onContentUpdateDelegate = this.policyComponent.registerClassPolicy(OnContentUpdatePolicy.class); this.onContentPropertyUpdateDelegate = this.policyComponent.registerClassPolicy(OnContentPropertyUpdatePolicy.class); this.onContentReadDelegate = this.policyComponent.registerClassPolicy(OnContentReadPolicy.class); }
@Test public void willCreateNonExistentCacheRoot() { File cacheRoot = new File(TempFileProvider.getTempDir(), GUID.generate()); cacheRoot.deleteOnExit(); assertFalse("Pre-condition of test is that cacheRoot does not exist", cacheRoot.exists()); contentCache.setCacheRoot(cacheRoot); assertTrue("cacheRoot should have been created", cacheRoot.exists()); }
private String extractToDir(String extension, String location) { File tmpDir = TempFileProvider.getTempDir(); try { TFile zipFile = new TFile(this.getClass().getClassLoader().getResource(location).getPath()); TFile outDir = new TFile(tmpDir.getAbsolutePath()+"/moduleManagementToolTestDir"+System.currentTimeMillis()); outDir.mkdir(); zipFile.cp_rp(outDir); TVFS.umount(zipFile); return outDir.getPath(); } catch (Exception e) { e.printStackTrace(); } return null; } public void testNoWar() throws Exception
@Before public void before() throws Exception { // create a store that uses a subdirectory of the temp directory File tempDir = TempFileProvider.getTempDir(); store = new FileContentStore(ctx, tempDir.getAbsolutePath() + File.separatorChar + getName()); store.setDeleteEmptyDirs(true); // Do not need super class's transactions }
@Before public void before() throws Exception { // create a store that uses a subdirectory of the temp directory File tempDir = TempFileProvider.getTempDir(); store = new FileContentStore(ctx, tempDir.getAbsolutePath() + File.separatorChar + getName()); // disallow random access store.setAllowRandomAccess(false); }
@Before public void setUp() throws Exception { contentCache = new ContentCacheImpl(); contentCache.setMemoryStore(lookupTable); contentCache.setCacheRoot(TempFileProvider.getTempDir()); }
@Before public void before() throws Exception { File tempDir = TempFileProvider.getTempDir(); backingStore = new FileContentStore(ctx, tempDir.getAbsolutePath() + File.separatorChar + getName()); cache = new ContentCacheImpl(); cache.setCacheRoot(TempFileProvider.getLongLifeTempDir("cached_content_test")); cache.setMemoryStore(createMemoryStore()); store = new CachingContentStore(backingStore, cache, false); }