Merge branch 'master' of https://github.com/bitsquare/bitsquare
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 10 KiB |
|
@ -22,7 +22,6 @@ import io.bitsquare.gui.main.trade.createoffer.CreateOfferPMTest;
|
||||||
import io.bitsquare.gui.util.BSFormatterTest;
|
import io.bitsquare.gui.util.BSFormatterTest;
|
||||||
import io.bitsquare.gui.util.validation.BtcValidatorTest;
|
import io.bitsquare.gui.util.validation.BtcValidatorTest;
|
||||||
import io.bitsquare.gui.util.validation.FiatValidatorTest;
|
import io.bitsquare.gui.util.validation.FiatValidatorTest;
|
||||||
import io.bitsquare.msg.P2PNodeTest;
|
|
||||||
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Suite;
|
import org.junit.runners.Suite;
|
||||||
|
@ -30,7 +29,7 @@ import org.junit.runners.Suite;
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({
|
||||||
RestrictionsTest.class,
|
RestrictionsTest.class,
|
||||||
P2PNodeTest.class,
|
/* P2PNodeTest.class,*/
|
||||||
FiatValidatorTest.class,
|
FiatValidatorTest.class,
|
||||||
RestrictionsTest.class,
|
RestrictionsTest.class,
|
||||||
CreateOfferPMTest.class,
|
CreateOfferPMTest.class,
|
||||||
|
|
|
@ -43,6 +43,7 @@ import net.tomp2p.storage.Data;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -93,6 +94,7 @@ public class BasicUsecasesInLANTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testBootstrap() throws Exception {
|
public void testBootstrap() throws Exception {
|
||||||
PeerDHT peerDHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
PeerDHT peerDHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
||||||
assertEquals(CLIENT_1_PORT, peerDHT.peerAddress().tcpPort());
|
assertEquals(CLIENT_1_PORT, peerDHT.peerAddress().tcpPort());
|
||||||
|
@ -101,6 +103,7 @@ public class BasicUsecasesInLANTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testDHT() throws Exception {
|
public void testDHT() throws Exception {
|
||||||
PeerDHT peer1DHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
PeerDHT peer1DHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
||||||
PeerDHT peer2DHT = startClient(CLIENT_2_ID, CLIENT_2_PORT);
|
PeerDHT peer2DHT = startClient(CLIENT_2_ID, CLIENT_2_PORT);
|
||||||
|
@ -121,6 +124,7 @@ public class BasicUsecasesInLANTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testSendDirect() throws Exception {
|
public void testSendDirect() throws Exception {
|
||||||
PeerDHT peer1DHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
PeerDHT peer1DHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
||||||
PeerDHT peer2DHT = startClient(CLIENT_2_ID, CLIENT_2_PORT);
|
PeerDHT peer2DHT = startClient(CLIENT_2_ID, CLIENT_2_PORT);
|
||||||
|
|
|
@ -112,12 +112,12 @@ public class BasicUsecasesInWANTest {
|
||||||
log.debug("############# udpPort = " + peerDHT.peerAddress().udpPort());
|
log.debug("############# udpPort = " + peerDHT.peerAddress().udpPort());
|
||||||
|
|
||||||
// in case of port forwarding use that:
|
// in case of port forwarding use that:
|
||||||
//assertEquals(CLIENT_IP, peerDHT.peerAddress().inetAddress().getHostAddress());
|
assertEquals(CLIENT_IP, peerDHT.peerAddress().inetAddress().getHostAddress());
|
||||||
|
|
||||||
// in case of relay use that:
|
// in case of relay use that:
|
||||||
assertEquals("192.168.1.33", peerDHT.peerAddress().inetAddress().getHostAddress());
|
//assertEquals("192.168.1.33", peerDHT.peerAddress().inetAddress().getHostAddress());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
peerDHT.shutdown().awaitUninterruptibly();
|
peerDHT.shutdown().awaitUninterruptibly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,9 +129,11 @@ public class BasicUsecasesInWANTest {
|
||||||
|
|
||||||
FuturePut futurePut1 = peer1DHT.put(Number160.createHash("key")).data(new Data("hallo1")).start();
|
FuturePut futurePut1 = peer1DHT.put(Number160.createHash("key")).data(new Data("hallo1")).start();
|
||||||
futurePut1.awaitUninterruptibly();
|
futurePut1.awaitUninterruptibly();
|
||||||
|
log.debug("futurePut1.isSuccess() = " + futurePut1.isSuccess());
|
||||||
// why fails that?
|
// why fails that?
|
||||||
// assertTrue(futurePut1.isSuccess());
|
// assertTrue(futurePut1.isSuccess());
|
||||||
|
|
||||||
|
|
||||||
FutureGet futureGet2 = peer1DHT.get(Number160.createHash("key")).start();
|
FutureGet futureGet2 = peer1DHT.get(Number160.createHash("key")).start();
|
||||||
futureGet2.awaitUninterruptibly();
|
futureGet2.awaitUninterruptibly();
|
||||||
assertTrue(futureGet2.isSuccess());
|
assertTrue(futureGet2.isSuccess());
|
||||||
|
@ -208,7 +210,7 @@ No future set beforehand, probably an early shutdown / timeout, or use setFailed
|
||||||
|
|
||||||
futureDirect.awaitUninterruptibly();
|
futureDirect.awaitUninterruptibly();
|
||||||
|
|
||||||
countDownLatch.await(5, TimeUnit.SECONDS);
|
countDownLatch.await(3, TimeUnit.SECONDS);
|
||||||
if (countDownLatch.getCount() > 0)
|
if (countDownLatch.getCount() > 0)
|
||||||
Assert.fail("The test method did not complete successfully!");
|
Assert.fail("The test method did not complete successfully!");
|
||||||
|
|
||||||
|
@ -238,9 +240,21 @@ No future set beforehand, probably an early shutdown / timeout, or use setFailed
|
||||||
FutureNAT futureNAT = peerNAT.startSetupPortforwarding(futureDiscover);
|
FutureNAT futureNAT = peerNAT.startSetupPortforwarding(futureDiscover);
|
||||||
futureNAT.awaitUninterruptibly();
|
futureNAT.awaitUninterruptibly();
|
||||||
if (futureNAT.isSuccess()) {
|
if (futureNAT.isSuccess()) {
|
||||||
log.info("Automatic port forwarding is setup. Address = " +
|
FutureDiscover futureDiscover2 = peer.discover().peerAddress(masterNodeAddress).start();
|
||||||
futureNAT.peerAddress());
|
futureDiscover2.awaitUninterruptibly();
|
||||||
return peerDHT;
|
if (futureDiscover.isSuccess()) {
|
||||||
|
log.info("Discover with direct connection successful. Address = " + futureDiscover
|
||||||
|
.peerAddress());
|
||||||
|
|
||||||
|
log.info("Automatic port forwarding is setup. Address = " +
|
||||||
|
futureNAT.peerAddress());
|
||||||
|
return peerDHT;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.error("Bootstrap with NAT after futureDiscover2 failed " + futureDiscover2.failedReason());
|
||||||
|
peer.shutdown().awaitUninterruptibly();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FutureRelayNAT futureRelayNAT = peerNAT.startRelay(futureDiscover, futureNAT);
|
FutureRelayNAT futureRelayNAT = peerNAT.startRelay(futureDiscover, futureNAT);
|
||||||
|
|