@Test public void findProcessConfigFiles() throws URISyntaxException { JmxTransConfiguration configuration = new JmxTransConfiguration(); configuration.setProcessConfigDir(new File(ConfigurationParserTest.class.getResource("/example.json").toURI()).getParentFile()); JmxTransformer jmxTransformer = createJmxTransformer(configuration); List<File> processConfigFiles = jmxTransformer.getProcessConfigFiles(); assertThat(processConfigFiles).hasSize(7); }
@VisibleForTesting List<File> getProcessConfigFiles() { File[] files; File configurationDirOrFile = configuration.getProcessConfigDirOrFile(); if (configurationDirOrFile == null) { throw new IllegalStateException("Configuration should specify configuration directory or file, with -j of -f option"); } if (configurationDirOrFile.isFile()) { files = new File[1]; files[0] = configurationDirOrFile; } else { files = firstNonNull(configurationDirOrFile.listFiles(), new File[0]); } List<File> result = new ArrayList<>(); for (File file : files) { if (this.isProcessConfigFile(file)) { result.add(file); } } return result; }
JmxTransformer implements WatchedCallback { @VisibleForTesting List<File> getProcessConfigFiles() { File[] files; File configurationDirOrFile = configuration.getProcessConfigDirOrFile(); if (configurationDirOrFile == null) { throw new IllegalStateException("Configuration should specify configuration directory or file, with -j of -f option"); } if (configurationDirOrFile.isFile()) { files = new File[1]; files[0] = configurationDirOrFile; } else { files = firstNonNull(configurationDirOrFile.listFiles(), new File[0]); } List<File> result = new ArrayList<>(); for (File file : files) { if (this.isProcessConfigFile(file)) { result.add(file); } } return result; } }
JmxTransformer implements WatchedCallback { @VisibleForTesting List<File> getProcessConfigFiles() { File[] files; File configurationDirOrFile = configuration.getProcessConfigDirOrFile(); if (configurationDirOrFile == null) { throw new IllegalStateException("Configuration should specify configuration directory or file, with -j of -f option"); } if (configurationDirOrFile.isFile()) { files = new File[1]; files[0] = configurationDirOrFile; } else { files = firstNonNull(configurationDirOrFile.listFiles(), new File[0]); } List<File> result = new ArrayList<>(); for (File file : files) { if (this.isProcessConfigFile(file)) { result.add(file); } } return result; } @Inject  JmxTransformer(
			@Nonnull ServerScheduler serverScheduler,
			JmxTransConfiguration configuration,
			ConfigurationParser configurationParser,
			Injector injector,
			@Nonnull @Named("queryExecutorRepository") ExecutorRepository queryExecutorRepository,
			@Nonnull @Named("resultExecutorRepository") ExecutorRepository resultExecutorRepository,
			@Nonnull ScheduledExecutorService scheduledExecutor
	); }
JmxTransformer implements WatchedCallback { @VisibleForTesting List<File> getProcessConfigFiles() { File[] files; File configurationDirOrFile = configuration.getProcessConfigDirOrFile(); if (configurationDirOrFile == null) { throw new IllegalStateException("Configuration should specify configuration directory or file, with -j of -f option"); } if (configurationDirOrFile.isFile()) { files = new File[1]; files[0] = configurationDirOrFile; } else { files = firstNonNull(configurationDirOrFile.listFiles(), new File[0]); } List<File> result = new ArrayList<>(); for (File file : files) { if (this.isProcessConfigFile(file)) { result.add(file); } } return result; } @Inject  JmxTransformer(
			@Nonnull ServerScheduler serverScheduler,
			JmxTransConfiguration configuration,
			ConfigurationParser configurationParser,
			Injector injector,
			@Nonnull @Named("queryExecutorRepository") ExecutorRepository queryExecutorRepository,
			@Nonnull @Named("resultExecutorRepository") ExecutorRepository resultExecutorRepository,
			@Nonnull ScheduledExecutorService scheduledExecutor
	); static void main(String[] args); static JmxTransformer create(JmxTransConfiguration configuration); synchronized void start(); synchronized void stop(); void executeStandalone(JmxProcess process); @Override void fileModified(File file); @Override void fileDeleted(File file); @Override void fileAdded(File file); }
JmxTransformer implements WatchedCallback { @VisibleForTesting List<File> getProcessConfigFiles() { File[] files; File configurationDirOrFile = configuration.getProcessConfigDirOrFile(); if (configurationDirOrFile == null) { throw new IllegalStateException("Configuration should specify configuration directory or file, with -j of -f option"); } if (configurationDirOrFile.isFile()) { files = new File[1]; files[0] = configurationDirOrFile; } else { files = firstNonNull(configurationDirOrFile.listFiles(), new File[0]); } List<File> result = new ArrayList<>(); for (File file : files) { if (this.isProcessConfigFile(file)) { result.add(file); } } return result; } @Inject  JmxTransformer(
			@Nonnull ServerScheduler serverScheduler,
			JmxTransConfiguration configuration,
			ConfigurationParser configurationParser,
			Injector injector,
			@Nonnull @Named("queryExecutorRepository") ExecutorRepository queryExecutorRepository,
			@Nonnull @Named("resultExecutorRepository") ExecutorRepository resultExecutorRepository,
			@Nonnull ScheduledExecutorService scheduledExecutor
	); static void main(String[] args); static JmxTransformer create(JmxTransConfiguration configuration); synchronized void start(); synchronized void stop(); void executeStandalone(JmxProcess process); @Override void fileModified(File file); @Override void fileDeleted(File file); @Override void fileAdded(File file);  }