ConfigurationFileManager { public void saveConfiguration(final String includes, final String excludes) { final InputStreamFromOutputStream<Object> input = new InputStreamFromOutputStream<Object>() { @Override protected Object produce(final OutputStream output) throws Exception { final DirScanner scanner = new DirScanner.Glob(includes, excludes); rootDirectory.zip(output, scanner); return null; } }; configurationProvider.getStorage().save(input); } ConfigurationFileManager();   ConfigurationFileManager(final ConfigurationProvider configurationProvider, final File rootDirectory); void initConfiguration(); void restoreConfiguration(); void unzipFilesFrom(final FileItem file); void deleteFile(final String path); void saveConfiguration(final String includes, final String excludes); InputStream downloadStoredConfiguration(); File getRootDirectory();  }
@Test public void testSaveExclusionPattern() throws Exception { final EntryNamesVerifyingStorage storage = new EntryNamesVerifyingStorage(); final ConfigurationFileManager subject = getTestJenkinsConfiguration(storage); tempDir.newFile("example.txt"); tempDir.newFile("example.exe"); subject.saveConfiguration("*", "*.exe"); assertEquals(Collections.singletonList("example.txt"), storage.names); }
@Test public void testSaveNothing() throws Exception { final EntryNamesVerifyingStorage storage = new EntryNamesVerifyingStorage(); final ConfigurationFileManager subject = getTestJenkinsConfiguration(storage); subject.saveConfiguration("", ""); assertEquals(Collections.emptyList(), storage.names); }
@Test public void testSaveOneFile() throws Exception { final EntryNamesVerifyingStorage storage = new EntryNamesVerifyingStorage(); final ConfigurationFileManager subject = getTestJenkinsConfiguration(storage); tempDir.newFile("example.txt"); subject.saveConfiguration("*.txt", ""); assertEquals(Collections.singletonList("example.txt"), storage.names); }