/** * Get the location for storing temporary uploaded files (not for general temporary files) * @return the directory * @throws Exception */ private File getTempUploadDir() throws Exception { if (m_tempUploadDir == null) { try { m_tempUploadDir = getServer().getUploadDir(); } catch (InitializationException e) { throw new Exception("Unable to get server: " + e.getMessage(), e); } } return m_tempUploadDir; }
/** * Get the location for storing temporary uploaded files (not for general temporary files) * @return the directory * @throws Exception */ private File getTempUploadDir() throws Exception { if (m_tempUploadDir == null) { try { m_tempUploadDir = getServer().getUploadDir(); } catch (InitializationException e) { throw new Exception("Unable to get server: " + e.getMessage(), e); } } return m_tempUploadDir; }
m_tempDir = getServer().getUploadDir(); if (!m_tempDir.isDirectory()) { m_tempDir.mkdirs();
m_tempDir = getServer().getUploadDir(); if (!m_tempDir.isDirectory()) { m_tempDir.mkdirs();
/** * Test method for {@link org.fcrepo.server.management.ManagementModule#initModule()}. */ @Test public void testInitModuleFailsWithoutUploadDirectory() throws Exception { thrown.expect(ModuleInitializationException.class); thrown.expectMessage(JUnitMatchers .containsString("Failed to create temp dir at")); File badUploadDir = folder.newFile("fileNotDirectory"); Server mockedServer = mock(BasicServer.class); when(mockedServer.getUploadDir()).thenReturn(badUploadDir); Map<String, String> params = new HashMap<String, String>(); ManagementModule mm = new ManagementModule(params, null, null); ManagementModule spy = spy(mm); when(spy.getServer()).thenReturn(mockedServer); spy.initModule(); } }