refactor: 抽象通知器管理器
This commit is contained in:
parent
e121652f62
commit
2d48623733
@ -8,7 +8,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
/**
|
||||
* @author xueye
|
||||
*/
|
||||
public class DefaultNotifierManager implements NotifierManager {
|
||||
public abstract class AbstractNotifierManager implements NotifierManager {
|
||||
private final Map<String, Map<String, NotifierProvider>> providers = new ConcurrentHashMap<>();
|
||||
|
||||
private Map<String, Notifier> notifiers = new ConcurrentHashMap<>();
|
||||
@ -17,7 +17,7 @@ public class DefaultNotifierManager implements NotifierManager {
|
||||
|
||||
// private EventBus eventBus;
|
||||
|
||||
public DefaultNotifierManager(NotifyConfigManager manager/*, EventBus eventBus*/) {
|
||||
public AbstractNotifierManager(NotifyConfigManager manager/*, EventBus eventBus*/) {
|
||||
this.configManager = manager;
|
||||
// this.eventBus = eventBus;
|
||||
}
|
@ -54,7 +54,7 @@ public class DingTalkTest {
|
||||
}
|
||||
};
|
||||
|
||||
NotifierManager notifierManager = new DefaultNotifierManager(notifyConfigManager);
|
||||
NotifierManager notifierManager = new AbstractNotifierManager(notifyConfigManager){};
|
||||
|
||||
// register
|
||||
DingTalkNotifierProvider provider = new DingTalkNotifierProvider(templateManager);
|
||||
|
@ -61,7 +61,7 @@ public class DefaultEmailTest {
|
||||
}
|
||||
};
|
||||
|
||||
NotifierManager notifierManager = new DefaultNotifierManager(notifyConfigManager);
|
||||
NotifierManager notifierManager = new AbstractNotifierManager(notifyConfigManager){};
|
||||
DefaultEmailNotifierProvider defaultEmailNotifierProvider = new DefaultEmailNotifierProvider(templateManager);
|
||||
// register
|
||||
notifierManager.registerProvider(defaultEmailNotifierProvider);
|
||||
|
@ -8,7 +8,6 @@ import com.cicdi.notify.template.TemplateManager;
|
||||
import com.cicdi.notify.template.TemplateProperties;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -53,7 +52,7 @@ public class AliyunSmsTest {
|
||||
}
|
||||
};
|
||||
|
||||
NotifierManager notifierManager = new DefaultNotifierManager(notifyConfigManager);
|
||||
NotifierManager notifierManager = new AbstractNotifierManager(notifyConfigManager){};
|
||||
AliyunSmsNotifierProvider aliyunSmsNotifierProvider = new AliyunSmsNotifierProvider(templateManager);
|
||||
// register
|
||||
notifierManager.registerProvider(aliyunSmsNotifierProvider);
|
||||
|
@ -52,7 +52,7 @@ public class TelecomSmsTest {
|
||||
}
|
||||
};
|
||||
|
||||
NotifierManager notifierManager = new DefaultNotifierManager(notifyConfigManager);
|
||||
NotifierManager notifierManager = new AbstractNotifierManager(notifyConfigManager){};
|
||||
|
||||
// register
|
||||
AliyunSmsNotifierProvider aliyunSmsNotifierProvider = new AliyunSmsNotifierProvider(templateManager);
|
||||
|
@ -54,7 +54,7 @@ public class WechatTest {
|
||||
}
|
||||
};
|
||||
|
||||
NotifierManager notifierManager = new DefaultNotifierManager(notifyConfigManager);
|
||||
NotifierManager notifierManager = new AbstractNotifierManager(notifyConfigManager){};
|
||||
|
||||
// register
|
||||
WechatNotifierProvider provider = new WechatNotifierProvider(templateManager);
|
||||
|
Loading…
Reference in New Issue
Block a user