@Test public void canCreateIniFiles() throws IOException, NoSuchFieldException, IllegalAccessException { IniManager iniManager = new IniManager(_mockPropertiesUtil); LaunchStreamingJobMessage launchMessage = StreamingJobTestUtil.createLaunchMessage(); JobIniFiles jobIniFiles = iniManager.createJobIniFiles(launchMessage); assertFieldsWritten(launchMessage, jobIniFiles.getJobIniPath(), 11); assertPropertiesWritten(launchMessage.jobProperties, jobIniFiles.getJobIniPath(), IniManager.JOB_PROPERTIES_SECTION); assertPropertiesWritten(launchMessage.mediaProperties, jobIniFiles.getJobIniPath(), IniManager.MEDIA_PROPERTIES_SECTION); jobIniFiles.deleteIniFiles(); assertTrue(Files.notExists(jobIniFiles.getJobIniPath())); }
public JobIniFiles createJobIniFiles(LaunchStreamingJobMessage launchMessage) { try { Files.createDirectories(_propertiesUtil.getIniFilesDir()); Path jobIniDir = Files.createTempDirectory( _propertiesUtil.getIniFilesDir(), String.format("mpf-job-%s-ini-files", launchMessage.jobId)) .toAbsolutePath(); jobIniDir.toFile().deleteOnExit(); Path iniFile = createIniFile(launchMessage, jobIniDir); return new JobIniFiles(jobIniDir, iniFile); } catch (IOException e) { throw new UncheckedIOException( "An error occurred while trying to create INI files for job " + launchMessage.jobId, e); } }
IniManager { public JobIniFiles createJobIniFiles(LaunchStreamingJobMessage launchMessage) { try { Files.createDirectories(_propertiesUtil.getIniFilesDir()); Path jobIniDir = Files.createTempDirectory( _propertiesUtil.getIniFilesDir(), String.format("mpf-job-%s-ini-files", launchMessage.jobId)) .toAbsolutePath(); jobIniDir.toFile().deleteOnExit(); Path iniFile = createIniFile(launchMessage, jobIniDir); return new JobIniFiles(jobIniDir, iniFile); } catch (IOException e) { throw new UncheckedIOException( "An error occurred while trying to create INI files for job " + launchMessage.jobId, e); } } }
IniManager { public JobIniFiles createJobIniFiles(LaunchStreamingJobMessage launchMessage) { try { Files.createDirectories(_propertiesUtil.getIniFilesDir()); Path jobIniDir = Files.createTempDirectory( _propertiesUtil.getIniFilesDir(), String.format("mpf-job-%s-ini-files", launchMessage.jobId)) .toAbsolutePath(); jobIniDir.toFile().deleteOnExit(); Path iniFile = createIniFile(launchMessage, jobIniDir); return new JobIniFiles(jobIniDir, iniFile); } catch (IOException e) { throw new UncheckedIOException( "An error occurred while trying to create INI files for job " + launchMessage.jobId, e); } } @Autowired  IniManager(PropertiesUtil propertiesUtil); }
IniManager { public JobIniFiles createJobIniFiles(LaunchStreamingJobMessage launchMessage) { try { Files.createDirectories(_propertiesUtil.getIniFilesDir()); Path jobIniDir = Files.createTempDirectory( _propertiesUtil.getIniFilesDir(), String.format("mpf-job-%s-ini-files", launchMessage.jobId)) .toAbsolutePath(); jobIniDir.toFile().deleteOnExit(); Path iniFile = createIniFile(launchMessage, jobIniDir); return new JobIniFiles(jobIniDir, iniFile); } catch (IOException e) { throw new UncheckedIOException( "An error occurred while trying to create INI files for job " + launchMessage.jobId, e); } } @Autowired  IniManager(PropertiesUtil propertiesUtil); JobIniFiles createJobIniFiles(LaunchStreamingJobMessage launchMessage); }
IniManager { public JobIniFiles createJobIniFiles(LaunchStreamingJobMessage launchMessage) { try { Files.createDirectories(_propertiesUtil.getIniFilesDir()); Path jobIniDir = Files.createTempDirectory( _propertiesUtil.getIniFilesDir(), String.format("mpf-job-%s-ini-files", launchMessage.jobId)) .toAbsolutePath(); jobIniDir.toFile().deleteOnExit(); Path iniFile = createIniFile(launchMessage, jobIniDir); return new JobIniFiles(jobIniDir, iniFile); } catch (IOException e) { throw new UncheckedIOException( "An error occurred while trying to create INI files for job " + launchMessage.jobId, e); } } @Autowired  IniManager(PropertiesUtil propertiesUtil); JobIniFiles createJobIniFiles(LaunchStreamingJobMessage launchMessage); static final String DEFAULT_SECTION; static final String JOB_PROPERTIES_SECTION; static final String MEDIA_PROPERTIES_SECTION; }