Commits

Anonymous committed 578cb4d

Migrate IntegrationTests to use WebappModule

Comments (0)

Files changed (2)

chempound-webapp/src/main/java/net/chempound/webapp/StubConfigurationWebAppModule.java

+package net.chempound.webapp;
+
+import com.google.inject.Module;
+import net.chempound.ChempoundConfigurationModule;
+import net.chempound.config.ChempoundConfiguration;
+import net.chempound.config.DefaultPropertySource;
+import net.chempound.config.StubChempoundConfiguration;
+
+import java.io.File;
+import java.net.URI;
+
+public class StubConfigurationWebAppModule extends ChempoundWebappModule {
+
+    private final URI baseUri;
+    private final File workspace;
+    private final Module[] plugins;
+
+    public StubConfigurationWebAppModule(final URI baseUri, final File workspace, final Module... plugins) {
+        this.baseUri = baseUri;
+        this.workspace = workspace;
+        this.plugins = plugins;
+    }
+
+    @Override
+    protected Module getConfigurationModule() {
+        final ChempoundConfiguration configuration = new StubChempoundConfiguration(baseUri, workspace);
+        return new ChempoundConfigurationModule(configuration, new DefaultPropertySource());
+    }
+
+    @Override
+    protected void installPlugins() {
+        for (final Module plugin : plugins) {
+            install(plugin);
+        }
+    }
+}

chempound-webapp/src/test/java/net/chempound/webapp/StubConfigurationWebAppModule.java

-package net.chempound.webapp;
-
-import com.google.inject.Module;
-import net.chempound.ChempoundConfigurationModule;
-import net.chempound.config.ChempoundConfiguration;
-import net.chempound.config.DefaultPropertySource;
-import net.chempound.config.StubChempoundConfiguration;
-
-import java.io.File;
-import java.net.URI;
-
-class StubConfigurationWebAppModule extends ChempoundWebappModule {
-
-    private final URI baseUri;
-    private final File workspace;
-
-    public StubConfigurationWebAppModule(final URI baseUri, final File workspace) {
-        this.baseUri = baseUri;
-        this.workspace = workspace;
-    }
-
-    @Override
-    protected Module getConfigurationModule() {
-        final ChempoundConfiguration configuration = new StubChempoundConfiguration(baseUri, workspace);
-        return new ChempoundConfigurationModule(configuration, new DefaultPropertySource());
-    }
-}