Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test guice setup and fix #3043

Merged
merged 5 commits into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ configure(project(':seednode')) {
runtime "org.bouncycastle:bcprov-jdk15on:$bcVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
testCompile "org.springframework:spring-test:$springVersion"

christophsturm marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
3 changes: 0 additions & 3 deletions core/src/main/java/bisq/core/CoreModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
import com.google.inject.Singleton;
import com.google.inject.name.Names;

import java.time.Clock;

import java.io.File;

import static com.google.inject.name.Names.named;
Expand Down Expand Up @@ -99,7 +97,6 @@ protected void configure() {
bind(BridgeAddressProvider.class).to(Preferences.class).in(Singleton.class);
bind(CorruptedDatabaseFilesHandler.class).in(Singleton.class);
bind(AvoidStandbyModeService.class).in(Singleton.class);
bind(Clock.class).toInstance(Clock.systemDefaultZone());

bind(SeedNodeRepository.class).to(DefaultSeedNodeRepository.class).in(Singleton.class);

Expand Down
3 changes: 3 additions & 0 deletions p2p/src/main/java/bisq/network/p2p/P2PModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import com.google.inject.Singleton;
import com.google.inject.name.Names;

import java.time.Clock;

import java.io.File;

import static com.google.inject.name.Names.named;
Expand All @@ -54,6 +56,7 @@ public P2PModule(Environment environment) {

@Override
protected void configure() {
bind(Clock.class).toInstance(Clock.systemDefaultZone());
bind(P2PService.class).in(Singleton.class);
bind(PeerManager.class).in(Singleton.class);
bind(P2PDataStorage.class).in(Singleton.class);
Expand Down
19 changes: 19 additions & 0 deletions seednode/src/test/java/bisq/seednode/GuiceSetupTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package bisq.seednode;

import bisq.core.app.BisqEnvironment;
import bisq.core.app.misc.AppSetupWithP2PAndDAO;
import bisq.core.app.misc.ModuleForAppWithP2p;

import org.springframework.mock.env.MockPropertySource;

import com.google.inject.Guice;

import org.junit.Test;

public class GuiceSetupTest {
@Test
public void testGuiceSetup() {
ModuleForAppWithP2p module = new ModuleForAppWithP2p(new BisqEnvironment(new MockPropertySource()));
Guice.createInjector(module).getInstance(AppSetupWithP2PAndDAO.class);
}
}