projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c2749a0
)
🚧 Add notification manager to web interface module
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Fri, 29 Nov 2019 16:30:45 +0000
(17:30 +0100)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Fri, 29 Nov 2019 17:27:14 +0000
(18:27 +0100)
src/main/java/net/pterodactylus/sone/web/WebInterface.java
patch
|
blob
|
history
src/main/kotlin/net/pterodactylus/sone/web/WebInterfaceModule.kt
patch
|
blob
|
history
src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt
patch
|
blob
|
history
diff --git
a/src/main/java/net/pterodactylus/sone/web/WebInterface.java
b/src/main/java/net/pterodactylus/sone/web/WebInterface.java
index
e31d9a8
..
bcc7a11
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/WebInterface.java
+++ b/
src/main/java/net/pterodactylus/sone/web/WebInterface.java
@@
-124,7
+124,7
@@
public class WebInterface implements SessionProvider {
private final Loaders loaders;
/** The notification manager. */
private final Loaders loaders;
/** The notification manager. */
- private final NotificationManager notificationManager
= new NotificationManager()
;
+ private final NotificationManager notificationManager;
/** The Sone plugin. */
private final SonePlugin sonePlugin;
/** The Sone plugin. */
private final SonePlugin sonePlugin;
@@
-207,7
+207,8
@@
public class WebInterface implements SessionProvider {
ParserFilter parserFilter, ShortenFilter shortenFilter,
RenderFilter renderFilter,
LinkedElementRenderFilter linkedElementRenderFilter,
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.sonePlugin = sonePlugin;
this.loaders = loaders;
this.listNotificationFilter = listNotificationFilter;
@@
-223,6
+224,7
@@
public class WebInterface implements SessionProvider {
this.metricRegistry = metricRegistry;
this.l10nFilter = l10nFilter;
this.translation = translation;
this.metricRegistry = metricRegistry;
this.l10nFilter = l10nFilter;
this.translation = translation;
+ this.notificationManager = notificationManager;
formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
soneTextParser = new SoneTextParser(getCore(), getCore());
formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
soneTextParser = new SoneTextParser(getCore(), getCore());
diff --git
a/src/main/kotlin/net/pterodactylus/sone/web/WebInterfaceModule.kt
b/src/main/kotlin/net/pterodactylus/sone/web/WebInterfaceModule.kt
index
c996e30
..
3d87aa7
100644
(file)
--- a/
src/main/kotlin/net/pterodactylus/sone/web/WebInterfaceModule.kt
+++ b/
src/main/kotlin/net/pterodactylus/sone/web/WebInterfaceModule.kt
@@
-10,6
+10,7
@@
import net.pterodactylus.sone.freenet.wot.*
import net.pterodactylus.sone.main.*
import net.pterodactylus.sone.template.*
import net.pterodactylus.sone.text.*
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
import net.pterodactylus.util.template.*
import javax.inject.*
import javax.inject.Singleton
@@
-126,4
+127,9
@@
class WebInterfaceModule : AbstractModule() {
@Named("toadletPathPrefix")
fun getPathPrefix(): String = "/Sone/"
@Named("toadletPathPrefix")
fun getPathPrefix(): String = "/Sone/"
+ @Provides
+ @Singleton
+ fun getNotificationManager() =
+ NotificationManager()
+
}
}
diff --git
a/src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt
b/src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt
index
14427ef
..
ec45e67
100644
(file)
--- a/
src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt
+++ b/
src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt
@@
-15,6
+15,7
@@
import net.pterodactylus.sone.template.*
import net.pterodactylus.sone.test.*
import net.pterodactylus.sone.text.*
import net.pterodactylus.sone.web.page.*
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.*
import net.pterodactylus.util.template.*
import net.pterodactylus.util.web.*
import org.hamcrest.MatcherAssert.*
@@
-283,4
+284,11
@@
class WebInterfaceModuleTest {
assertThat(injector.getInstance<PageToadletFactory>().createPageToadlet(page).path(), startsWith("/Sone/"))
}
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))
+ }
+
}
}