@Test public void shouldNotSaveConfigWhenNewFileCreatedIsNotSupported() throws IOException { final String fileName = "res:config/motech-settings.conf"; FileObject fileObject = VFS.getManager().resolveFile(fileName); configFileMonitor.fileCreated(new FileChangeEvent(fileObject)); verifyZeroInteractions(configurationService); }
@Override public void fileCreated(FileChangeEvent fileChangeEvent) throws IOException { FileObject fileObject = fileChangeEvent.getFile(); LOGGER.info(String.format("Received file creation event for file: %s", fileObject)); File file = new File(fileObject.getName().getPath()); if (ConfigFileFilter.isFileSupported(file)) { configurationService.addOrUpdate(file); Map<String, Object> params = new HashMap<>(); params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath()); sendEvent(ConfigurationConstants.FILE_CREATED_EVENT_SUBJECT, params); } }
ConfigFileMonitor implements FileListener { @Override public void fileCreated(FileChangeEvent fileChangeEvent) throws IOException { FileObject fileObject = fileChangeEvent.getFile(); LOGGER.info(String.format("Received file creation event for file: %s", fileObject)); File file = new File(fileObject.getName().getPath()); if (ConfigFileFilter.isFileSupported(file)) { configurationService.addOrUpdate(file); Map<String, Object> params = new HashMap<>(); params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath()); sendEvent(ConfigurationConstants.FILE_CREATED_EVENT_SUBJECT, params); } } }
ConfigFileMonitor implements FileListener { @Override public void fileCreated(FileChangeEvent fileChangeEvent) throws IOException { FileObject fileObject = fileChangeEvent.getFile(); LOGGER.info(String.format("Received file creation event for file: %s", fileObject)); File file = new File(fileObject.getName().getPath()); if (ConfigFileFilter.isFileSupported(file)) { configurationService.addOrUpdate(file); Map<String, Object> params = new HashMap<>(); params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath()); sendEvent(ConfigurationConstants.FILE_CREATED_EVENT_SUBJECT, params); } }  }
ConfigFileMonitor implements FileListener { @Override public void fileCreated(FileChangeEvent fileChangeEvent) throws IOException { FileObject fileObject = fileChangeEvent.getFile(); LOGGER.info(String.format("Received file creation event for file: %s", fileObject)); File file = new File(fileObject.getName().getPath()); if (ConfigFileFilter.isFileSupported(file)) { configurationService.addOrUpdate(file); Map<String, Object> params = new HashMap<>(); params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath()); sendEvent(ConfigurationConstants.FILE_CREATED_EVENT_SUBJECT, params); } }  void setFileMonitor(DefaultFileMonitor fileMonitor); @PostConstruct void init(); @Override void fileCreated(FileChangeEvent fileChangeEvent); @Override void fileChanged(FileChangeEvent fileChangeEvent); @Override void fileDeleted(FileChangeEvent fileChangeEvent); @PreDestroy void stop(); void updateFileMonitor(); }
ConfigFileMonitor implements FileListener { @Override public void fileCreated(FileChangeEvent fileChangeEvent) throws IOException { FileObject fileObject = fileChangeEvent.getFile(); LOGGER.info(String.format("Received file creation event for file: %s", fileObject)); File file = new File(fileObject.getName().getPath()); if (ConfigFileFilter.isFileSupported(file)) { configurationService.addOrUpdate(file); Map<String, Object> params = new HashMap<>(); params.put(ConfigurationConstants.FILE_PATH, file.getAbsolutePath()); sendEvent(ConfigurationConstants.FILE_CREATED_EVENT_SUBJECT, params); } }  void setFileMonitor(DefaultFileMonitor fileMonitor); @PostConstruct void init(); @Override void fileCreated(FileChangeEvent fileChangeEvent); @Override void fileChanged(FileChangeEvent fileChangeEvent); @Override void fileDeleted(FileChangeEvent fileChangeEvent); @PreDestroy void stop(); void updateFileMonitor();  }