Merge pull request #1373 from mgeiss/command-provider-test
added logging to detect build failure
This commit is contained in:
+10
-1
@@ -11,6 +11,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.mifosplatform.commands.annotation.CommandType;
|
import org.mifosplatform.commands.annotation.CommandType;
|
||||||
import org.mifosplatform.commands.exception.UnsupportedCommandException;
|
import org.mifosplatform.commands.exception.UnsupportedCommandException;
|
||||||
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
|
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
@@ -36,6 +38,8 @@ import java.util.HashMap;
|
|||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
public class CommandHandlerProvider implements ApplicationContextAware {
|
public class CommandHandlerProvider implements ApplicationContextAware {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandlerProvider.class);
|
||||||
|
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
private HashMap<String, String> registeredHandlers;
|
private HashMap<String, String> registeredHandlers;
|
||||||
|
|
||||||
@@ -70,8 +74,13 @@ public class CommandHandlerProvider implements ApplicationContextAware {
|
|||||||
final String[] commandHandlerBeans = this.applicationContext.getBeanNamesForAnnotation(CommandType.class);
|
final String[] commandHandlerBeans = this.applicationContext.getBeanNamesForAnnotation(CommandType.class);
|
||||||
if (ArrayUtils.isNotEmpty(commandHandlerBeans)) {
|
if (ArrayUtils.isNotEmpty(commandHandlerBeans)) {
|
||||||
for (final String commandHandlerName : commandHandlerBeans) {
|
for (final String commandHandlerName : commandHandlerBeans) {
|
||||||
|
LOGGER.info("Register command handler '" + commandHandlerName + "' ...");
|
||||||
final CommandType commandType = this.applicationContext.getType(commandHandlerName).getAnnotation(CommandType.class);
|
final CommandType commandType = this.applicationContext.getType(commandHandlerName).getAnnotation(CommandType.class);
|
||||||
this.registeredHandlers.put(commandType.entity() + "|" + commandType.action(), commandHandlerName);
|
try {
|
||||||
|
this.registeredHandlers.put(commandType.entity() + "|" + commandType.action(), commandHandlerName);
|
||||||
|
} catch (final Throwable th) {
|
||||||
|
LOGGER.error("Unable to register command handler '" + commandHandlerName + "'!", th);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|||||||
Reference in New Issue
Block a user