private final Loaders loaders;
/** The notification manager. */
- private final NotificationManager notificationManager = new NotificationManager();
+ private final NotificationManager notificationManager;
/** The Sone plugin. */
private final SonePlugin sonePlugin;
ParserFilter parserFilter, ShortenFilter shortenFilter,
RenderFilter renderFilter,
LinkedElementRenderFilter linkedElementRenderFilter,
- PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter) {
+ PageToadletRegistry pageToadletRegistry, MetricRegistry metricRegistry, Translation translation, L10nFilter l10nFilter,
+ NotificationManager notificationManager) {
this.sonePlugin = sonePlugin;
this.loaders = loaders;
this.listNotificationFilter = listNotificationFilter;
this.metricRegistry = metricRegistry;
this.l10nFilter = l10nFilter;
this.translation = translation;
+ this.notificationManager = notificationManager;
formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
soneTextParser = new SoneTextParser(getCore(), getCore());
import net.pterodactylus.sone.main.*
import net.pterodactylus.sone.template.*
import net.pterodactylus.sone.text.*
+import net.pterodactylus.util.notify.*
import net.pterodactylus.util.template.*
import javax.inject.*
import javax.inject.Singleton
@Named("toadletPathPrefix")
fun getPathPrefix(): String = "/Sone/"
+ @Provides
+ @Singleton
+ fun getNotificationManager() =
+ NotificationManager()
+
}
import net.pterodactylus.sone.test.*
import net.pterodactylus.sone.text.*
import net.pterodactylus.sone.web.page.*
+import net.pterodactylus.util.notify.*
import net.pterodactylus.util.template.*
import net.pterodactylus.util.web.*
import org.hamcrest.MatcherAssert.*
assertThat(injector.getInstance<PageToadletFactory>().createPageToadlet(page).path(), startsWith("/Sone/"))
}
+ @Test
+ fun `notification manager is created as singleton`() {
+ val firstNotificationManager = injector.getInstance<NotificationManager>()
+ val secondNotificationManager = injector.getInstance<NotificationManager>()
+ assertThat(firstNotificationManager, sameInstance(secondNotificationManager))
+ }
+
}