Skip to content

Commit

Permalink
Merge pull request #3043 from christophsturm/test-guice-setup-and-fix
Browse files Browse the repository at this point in the history
Test guice setup and fix
  • Loading branch information
sqrrm authored Aug 5, 2019
2 parents 2590ef9 + f96edd2 commit 276a506
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ 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"
}
}

Expand Down
1 change: 1 addition & 0 deletions common/src/main/java/bisq/common/crypto/KeyStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public String toString() {

@Inject
public KeyStorage(@Named(KEY_STORAGE_DIR) File storageDir) {
storageDir.mkdirs();
this.storageDir = storageDir;
}

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);
}
}

0 comments on commit 276a506

Please sign in to comment.