Search in sources :

Example 1 with MockData

use of io.bitsquare.p2p.storage.mocks.MockData in project bitsquare by bitsquare.

the class ProtectedDataStorageTest method setup.

@Before
public void setup() throws InterruptedException, NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, CryptoException, SignatureException, InvalidKeyException {
    Security.addProvider(new BouncyCastleProvider());
    dir1 = File.createTempFile("temp_tests1", "");
    dir1.delete();
    dir1.mkdir();
    dir2 = File.createTempFile("temp_tests2", "");
    dir2.delete();
    dir2.mkdir();
    UserThread.setExecutor(Executors.newSingleThreadExecutor());
    P2PDataStorage.CHECK_TTL_INTERVAL_SEC = 500;
    keyRing1 = new KeyRing(new KeyStorage(dir1));
    storageSignatureKeyPair1 = keyRing1.getSignatureKeyPair();
    encryptionService1 = new EncryptionService(keyRing1);
    P2PService p2PService = TestUtils.getAndStartSeedNode(8001, useClearNet, seedNodes).getSeedNodeP2PService();
    networkNode1 = p2PService.getNetworkNode();
    peerManager1 = p2PService.getPeerManager();
    dataStorage1 = p2PService.getP2PDataStorage();
    // for mailbox
    keyRing2 = new KeyRing(new KeyStorage(dir2));
    storageSignatureKeyPair2 = keyRing2.getSignatureKeyPair();
    encryptionService2 = new EncryptionService(keyRing2);
    mockData = new MockData("mockData", keyRing1.getSignatureKeyPair().getPublic());
    Thread.sleep(sleepTime);
}
Also used : EncryptionService(io.bitsquare.crypto.EncryptionService) MockData(io.bitsquare.p2p.storage.mocks.MockData) P2PService(io.bitsquare.p2p.P2PService) BouncyCastleProvider(org.bouncycastle.jce.provider.BouncyCastleProvider)

Aggregations

EncryptionService (io.bitsquare.crypto.EncryptionService)1 P2PService (io.bitsquare.p2p.P2PService)1 MockData (io.bitsquare.p2p.storage.mocks.MockData)1 BouncyCastleProvider (org.bouncycastle.jce.provider.BouncyCastleProvider)1