use of fr.xephi.authme.ClassCollector in project AuthMeReloaded by AuthMe.
the class ToolsRunner method main.
/**
* Entry point of the runner.
*
* @param args .
*/
public static void main(String... args) {
// Note ljacqu 20151212: If the tools folder becomes a lot bigger, it will make sense to restrict the depth
// of this recursive collector
ClassCollector collector = new ClassCollector(TestHelper.TEST_SOURCES_FOLDER, "tools");
Map<String, ToolTask> tasks = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (ToolTask task : collector.getInstancesOfType(ToolTask.class)) {
tasks.put(task.getTaskName(), task);
}
ToolsRunner runner = new ToolsRunner(tasks);
if (args == null || args.length == 0) {
runner.promptAndExecuteTask();
} else {
runner.executeAutomaticTasks(args);
}
}
use of fr.xephi.authme.ClassCollector in project AuthMeReloaded by AuthMe.
the class CheckTestMocks method executeDefault.
@Override
public void executeDefault() {
ClassCollector collector = new ClassCollector(TestHelper.TEST_SOURCES_FOLDER, TestHelper.PROJECT_ROOT);
for (Class<?> clazz : collector.collectClasses(c -> isTestClassWithMocks(c))) {
checkClass(clazz);
}
System.out.println(String.join("\n", errors));
}
use of fr.xephi.authme.ClassCollector in project AuthMeReloaded by AuthMe.
the class SettingsClassConsistencyTest method scanForSettingsClasses.
@BeforeClass
public static void scanForSettingsClasses() {
ClassCollector collector = new ClassCollector(TestHelper.SOURCES_FOLDER, SETTINGS_FOLDER);
classes = collector.collectClasses(SettingsHolder.class);
if (classes.isEmpty()) {
throw new IllegalStateException("Did not find any SettingsHolder classes. Is the folder correct?");
}
System.out.println("Found " + classes.size() + " SettingsHolder implementations");
}
use of fr.xephi.authme.ClassCollector in project AuthMeReloaded by AuthMe.
the class SettingsConsistencyTest method getSectionCommentMethods.
/**
* Gets all {@link SectionComments} methods from {@link SettingsHolder} implementations.
*/
@SuppressWarnings("unchecked")
private List<Method> getSectionCommentMethods() {
// Find all SettingsHolder classes
List<Class<? extends SettingsHolder>> settingsClasses = new ClassCollector(TestHelper.SOURCES_FOLDER, TestHelper.PROJECT_ROOT + "settings/properties/").collectClasses(SettingsHolder.class);
checkArgument(!settingsClasses.isEmpty(), "Could not find any SettingsHolder classes");
// Find all @SectionComments methods in these classes
return settingsClasses.stream().map(Class::getDeclaredMethods).flatMap(Arrays::stream).filter(method -> method.isAnnotationPresent(SectionComments.class)).collect(Collectors.toList());
}
Aggregations