* @throws InvocationTargetException If failed.
*/
private void configure(GridSpi spi) throws Exception {
// Inject Configuration.
for (Method m : getClass().getMethods()) {
GridSpiTestConfig cfg = m.getAnnotation(GridSpiTestConfig.class);
if (cfg != null) {
if (getTestData().isDiscoveryTest() ||
(cfg.type() != ConfigType.DISCOVERY && !(spi instanceof GridDiscoverySpi)) ||
(cfg.type() != ConfigType.SELF && spi instanceof GridDiscoverySpi)) {
assert m.getName().startsWith("get") : "Test configuration must be a getter [method=" +
m.getName() + ']';
// Determine getter name.
String name = cfg.setterName();
if (name == null || name.isEmpty())
name = 's' + m.getName().substring(1);
Method setter = getMethod(spi.getClass(), name);