🐛 Fix connectivity issues and improve code

This commit is contained in:
2018-10-15 10:49:04 +02:00
parent fe9fa0ba2f
commit 519f457476
13 changed files with 152 additions and 313 deletions

View File

@ -24,16 +24,16 @@ task fatCapsule(type: FatCapsule) {
}
dependencies {
compile project(':core')
compile project(':networking')
compile project(':repositories')
compile project(':cryptography-bc')
compile project(':wif')
compile 'org.slf4j:slf4j-simple'
compile 'args4j:args4j'
compile 'com.h2database:h2'
compile 'org.apache.commons:commons-text'
testCompile 'com.nhaarman:mockito-kotlin'
testCompile 'org.junit.jupiter:junit-jupiter-api'
implementation project(':core')
implementation project(':networking')
implementation project(':repositories')
implementation project(':cryptography-bc')
implementation project(':wif')
implementation 'org.slf4j:slf4j-simple'
implementation 'args4j:args4j'
implementation 'com.h2database:h2'
implementation 'org.apache.commons:commons-text'
testImplementation 'com.nhaarman:mockito-kotlin'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntime 'org.junit.jupiter:junit-jupiter-engine'
}

View File

@ -115,6 +115,7 @@ public class Application {
System.out.println(ctx.status());
System.out.println();
System.out.println("c) cleanup inventory");
System.out.println("n) remove known nodes");
System.out.println("r) resend unacknowledged messages");
System.out.println(COMMAND_BACK);
@ -123,6 +124,9 @@ public class Application {
case "c":
ctx.cleanup();
break;
case "n":
ctx.internals().getNodeRegistry().cleanup();
break;
case "r":
ctx.resendUnacknowledgedMessages();
break;

View File

@ -63,6 +63,7 @@ public class Main {
.inventory(new JdbcInventory(jdbcConfig))
.messageRepo(new JdbcMessageRepository(jdbcConfig))
.powRepo(new JdbcProofOfWorkRepository(jdbcConfig))
.labelRepo(new JdbcLabelRepository(jdbcConfig))
.networkHandler(new NioNetworkHandler())
.cryptography(new BouncyCryptography());
ctxBuilder.getPreferences().setPort(48444);

View File

@ -26,6 +26,7 @@ import ch.dissem.bitmessage.ports.Labeler
import ch.dissem.bitmessage.repository.*
import ch.dissem.bitmessage.utils.TTL
import ch.dissem.bitmessage.utils.UnixTime.MINUTE
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.spy
import com.nhaarman.mockito_kotlin.timeout
import com.nhaarman.mockito_kotlin.verify
@ -34,7 +35,6 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTimeoutPreemptively
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.any
import org.slf4j.LoggerFactory
import java.time.Duration.ofMinutes
import java.time.Duration.ofSeconds
@ -126,7 +126,7 @@ class SystemTest {
verify(
aliceLabeler,
timeout(TimeUnit.MINUTES.toMillis(2)).atLeastOnce()
).markAsAcknowledged(any<Plaintext>())
).markAsAcknowledged(any())
}
}
@ -145,7 +145,7 @@ class SystemTest {
}
}
internal class DebugLabeler internal constructor(private val name: String) : DefaultLabeler() {
internal open class DebugLabeler internal constructor(private val name: String) : DefaultLabeler() {
private val LOG = LoggerFactory.getLogger("Labeler")
private lateinit var alice: String
private lateinit var bob: String