aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/main/java/org
diff options
context:
space:
mode:
authorMoxie Marlinspike <moxie@thoughtcrime.org>2015-01-08 13:48:49 -0800
committerMoxie Marlinspike <moxie@thoughtcrime.org>2015-01-08 14:09:01 -0800
commit6445ea5f13850f42c3952bd06a2369317683ed88 (patch)
treef2bb37c8cf4710ff6a6a37a3e7e702c5a21ca504 /tests/src/main/java/org
parenta4d8f7f6a4c4e9e89db35f299e558dceee2362a1 (diff)
Break project up into Java and Android build/test.
Diffstat (limited to '')
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/InMemoryAxolotlStore.java (renamed from src/androidTest/java/org/whispersystems/test/InMemoryAxolotlStore.java)5
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/InMemoryIdentityKeyStore.java (renamed from src/androidTest/java/org/whispersystems/test/InMemoryIdentityKeyStore.java)4
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/InMemoryPreKeyStore.java (renamed from src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java)3
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/InMemorySessionStore.java (renamed from src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java)2
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/InMemorySignedPreKeyStore.java (renamed from src/androidTest/java/org/whispersystems/test/InMemorySignedPreKeyStore.java)3
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/SessionBuilderTest.java (renamed from src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java)21
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/SessionCipherTest.java (renamed from src/androidTest/java/org/whispersystems/test/SessionCipherTest.java)18
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/SimultaneousInitiateTests.java (renamed from src/androidTest/java/org/whispersystems/test/SimultaneousInitiateTests.java)24
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/ecc/Curve25519Test.java (renamed from src/androidTest/java/org/whispersystems/test/ecc/Curve25519Test.java)24
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipherTest.java (renamed from src/androidTest/java/org/whispersystems/test/groups/GroupCipherTest.java)11
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/groups/InMemorySenderKeyStore.java (renamed from src/androidTest/java/org/whispersystems/test/groups/InMemorySenderKeyStore.java)2
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/kdf/HKDFTest.java (renamed from src/androidTest/java/org/whispersystems/test/kdf/HKDFTest.java)8
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/ratchet/ChainKeyTest.java (renamed from src/androidTest/java/org/whispersystems/test/ratchet/ChainKeyTest.java)7
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionTest.java (renamed from src/androidTest/java/org/whispersystems/test/ratchet/RatchetingSessionTest.java)11
-rw-r--r--tests/src/main/java/org/whispersystems/libaxolotl/ratchet/RootKeyTest.java (renamed from src/androidTest/java/org/whispersystems/test/ratchet/RootKeyTest.java)8
15 files changed, 39 insertions, 112 deletions
diff --git a/src/androidTest/java/org/whispersystems/test/InMemoryAxolotlStore.java b/tests/src/main/java/org/whispersystems/libaxolotl/InMemoryAxolotlStore.java
index 4e001865..e375c574 100644
--- a/src/androidTest/java/org/whispersystems/test/InMemoryAxolotlStore.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/InMemoryAxolotlStore.java
@@ -1,8 +1,5 @@
-package org.whispersystems.test;
+package org.whispersystems.libaxolotl;
-import org.whispersystems.libaxolotl.IdentityKey;
-import org.whispersystems.libaxolotl.IdentityKeyPair;
-import org.whispersystems.libaxolotl.InvalidKeyIdException;
import org.whispersystems.libaxolotl.state.AxolotlStore;
import org.whispersystems.libaxolotl.state.PreKeyRecord;
import org.whispersystems.libaxolotl.state.SessionRecord;
diff --git a/src/androidTest/java/org/whispersystems/test/InMemoryIdentityKeyStore.java b/tests/src/main/java/org/whispersystems/libaxolotl/InMemoryIdentityKeyStore.java
index 8a2e1d8f..acb6110a 100644
--- a/src/androidTest/java/org/whispersystems/test/InMemoryIdentityKeyStore.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/InMemoryIdentityKeyStore.java
@@ -1,7 +1,5 @@
-package org.whispersystems.test;
+package org.whispersystems.libaxolotl;
-import org.whispersystems.libaxolotl.IdentityKey;
-import org.whispersystems.libaxolotl.IdentityKeyPair;
import org.whispersystems.libaxolotl.ecc.Curve;
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
import org.whispersystems.libaxolotl.state.IdentityKeyStore;
diff --git a/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java b/tests/src/main/java/org/whispersystems/libaxolotl/InMemoryPreKeyStore.java
index 7c3cea08..a2ea6811 100644
--- a/src/androidTest/java/org/whispersystems/test/InMemoryPreKeyStore.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/InMemoryPreKeyStore.java
@@ -1,6 +1,5 @@
-package org.whispersystems.test;
+package org.whispersystems.libaxolotl;
-import org.whispersystems.libaxolotl.InvalidKeyIdException;
import org.whispersystems.libaxolotl.state.PreKeyRecord;
import org.whispersystems.libaxolotl.state.PreKeyStore;
diff --git a/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java b/tests/src/main/java/org/whispersystems/libaxolotl/InMemorySessionStore.java
index 0d148ab0..2d03d437 100644
--- a/src/androidTest/java/org/whispersystems/test/InMemorySessionStore.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/InMemorySessionStore.java
@@ -1,4 +1,4 @@
-package org.whispersystems.test;
+package org.whispersystems.libaxolotl;
import org.whispersystems.libaxolotl.state.SessionRecord;
import org.whispersystems.libaxolotl.state.SessionStore;
diff --git a/src/androidTest/java/org/whispersystems/test/InMemorySignedPreKeyStore.java b/tests/src/main/java/org/whispersystems/libaxolotl/InMemorySignedPreKeyStore.java
index 7449eece..9f452d6d 100644
--- a/src/androidTest/java/org/whispersystems/test/InMemorySignedPreKeyStore.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/InMemorySignedPreKeyStore.java
@@ -1,6 +1,5 @@
-package org.whispersystems.test;
+package org.whispersystems.libaxolotl;
-import org.whispersystems.libaxolotl.InvalidKeyIdException;
import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
import org.whispersystems.libaxolotl.state.SignedPreKeyStore;
diff --git a/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java b/tests/src/main/java/org/whispersystems/libaxolotl/SessionBuilderTest.java
index 802f401d..0912493e 100644
--- a/src/androidTest/java/org/whispersystems/test/SessionBuilderTest.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/SessionBuilderTest.java
@@ -1,18 +1,7 @@
-package org.whispersystems.test;
-
-import android.test.AndroidTestCase;
-
-import org.whispersystems.libaxolotl.DuplicateMessageException;
-import org.whispersystems.libaxolotl.InvalidKeyException;
-import org.whispersystems.libaxolotl.InvalidKeyIdException;
-import org.whispersystems.libaxolotl.InvalidMessageException;
-import org.whispersystems.libaxolotl.InvalidVersionException;
-import org.whispersystems.libaxolotl.LegacyMessageException;
-import org.whispersystems.libaxolotl.NoSessionException;
-import org.whispersystems.libaxolotl.SessionBuilder;
-import org.whispersystems.libaxolotl.SessionCipher;
-import org.whispersystems.libaxolotl.StaleKeyExchangeException;
-import org.whispersystems.libaxolotl.UntrustedIdentityException;
+package org.whispersystems.libaxolotl;
+
+import junit.framework.TestCase;
+
import org.whispersystems.libaxolotl.ecc.Curve;
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
import org.whispersystems.libaxolotl.protocol.CiphertextMessage;
@@ -29,7 +18,7 @@ import org.whispersystems.libaxolotl.util.Pair;
import java.util.HashSet;
import java.util.Set;
-public class SessionBuilderTest extends AndroidTestCase {
+public class SessionBuilderTest extends TestCase {
private static final long ALICE_RECIPIENT_ID = 5L;
private static final long BOB_RECIPIENT_ID = 2L;
diff --git a/src/androidTest/java/org/whispersystems/test/SessionCipherTest.java b/tests/src/main/java/org/whispersystems/libaxolotl/SessionCipherTest.java
index 52b5fa89..e956ed77 100644
--- a/src/androidTest/java/org/whispersystems/test/SessionCipherTest.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/SessionCipherTest.java
@@ -1,15 +1,7 @@
-package org.whispersystems.test;
-
-import android.test.AndroidTestCase;
-
-import org.whispersystems.libaxolotl.DuplicateMessageException;
-import org.whispersystems.libaxolotl.IdentityKey;
-import org.whispersystems.libaxolotl.IdentityKeyPair;
-import org.whispersystems.libaxolotl.InvalidKeyException;
-import org.whispersystems.libaxolotl.InvalidMessageException;
-import org.whispersystems.libaxolotl.LegacyMessageException;
-import org.whispersystems.libaxolotl.NoSessionException;
-import org.whispersystems.libaxolotl.SessionCipher;
+package org.whispersystems.libaxolotl;
+
+import junit.framework.TestCase;
+
import org.whispersystems.libaxolotl.ecc.Curve;
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
@@ -31,7 +23,7 @@ import java.util.List;
import java.util.Random;
-public class SessionCipherTest extends AndroidTestCase {
+public class SessionCipherTest extends TestCase {
public void testBasicSessionV2()
throws InvalidKeyException, DuplicateMessageException,
diff --git a/src/androidTest/java/org/whispersystems/test/SimultaneousInitiateTests.java b/tests/src/main/java/org/whispersystems/libaxolotl/SimultaneousInitiateTests.java
index dffde57c..f09fedf8 100644
--- a/src/androidTest/java/org/whispersystems/test/SimultaneousInitiateTests.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/SimultaneousInitiateTests.java
@@ -1,18 +1,7 @@
-package org.whispersystems.test;
-
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import org.whispersystems.libaxolotl.DuplicateMessageException;
-import org.whispersystems.libaxolotl.InvalidKeyException;
-import org.whispersystems.libaxolotl.InvalidKeyIdException;
-import org.whispersystems.libaxolotl.InvalidMessageException;
-import org.whispersystems.libaxolotl.InvalidVersionException;
-import org.whispersystems.libaxolotl.LegacyMessageException;
-import org.whispersystems.libaxolotl.NoSessionException;
-import org.whispersystems.libaxolotl.SessionBuilder;
-import org.whispersystems.libaxolotl.SessionCipher;
-import org.whispersystems.libaxolotl.UntrustedIdentityException;
+package org.whispersystems.libaxolotl;
+
+import junit.framework.TestCase;
+
import org.whispersystems.libaxolotl.ecc.Curve;
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
import org.whispersystems.libaxolotl.protocol.CiphertextMessage;
@@ -27,7 +16,7 @@ import org.whispersystems.libaxolotl.util.Medium;
import java.util.Arrays;
import java.util.Random;
-public class SimultaneousInitiateTests extends AndroidTestCase {
+public class SimultaneousInitiateTests extends TestCase {
private static final long BOB_RECIPENT_ID = 12345;
private static final long ALICE_RECIPIENT_ID = 6789;
@@ -243,7 +232,6 @@ public class SimultaneousInitiateTests extends AndroidTestCase {
assertFalse(isSessionIdEqual(aliceStore, bobStore));
for (int i=0;i<50;i++) {
- Log.w("SimultaneousInitiateTests", "Iteration: " + i);
CiphertextMessage messageForBobRepeat = aliceSessionCipher.encrypt("hey there".getBytes());
CiphertextMessage messageForAliceRepeat = bobSessionCipher.encrypt("sample message".getBytes());
@@ -323,7 +311,6 @@ public class SimultaneousInitiateTests extends AndroidTestCase {
}
for (int i=0;i<50;i++) {
- Log.w("SimultaneousInitiateTests", "Iteration: " + i);
CiphertextMessage messageForBobRepeat = aliceSessionCipher.encrypt("hey there".getBytes());
CiphertextMessage messageForAliceRepeat = bobSessionCipher.encrypt("sample message".getBytes());
@@ -412,7 +399,6 @@ public class SimultaneousInitiateTests extends AndroidTestCase {
}
for (int i=0;i<50;i++) {
- Log.w("SimultaneousInitiateTests", "Iteration: " + i);
CiphertextMessage messageForBobRepeat = aliceSessionCipher.encrypt("hey there".getBytes());
CiphertextMessage messageForAliceRepeat = bobSessionCipher.encrypt("sample message".getBytes());
diff --git a/src/androidTest/java/org/whispersystems/test/ecc/Curve25519Test.java b/tests/src/main/java/org/whispersystems/libaxolotl/ecc/Curve25519Test.java
index 4b8ce2ea..b10085bb 100644
--- a/src/androidTest/java/org/whispersystems/test/ecc/Curve25519Test.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/ecc/Curve25519Test.java
@@ -1,20 +1,15 @@
-package org.whispersystems.test.ecc;
+package org.whispersystems.libaxolotl.ecc;
-import android.test.AndroidTestCase;
+import junit.framework.TestCase;
import org.whispersystems.libaxolotl.InvalidKeyException;
-import org.whispersystems.libaxolotl.ecc.Curve;
-import org.whispersystems.libaxolotl.ecc.ECKeyPair;
-import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
-import org.whispersystems.libaxolotl.ecc.ECPublicKey;
import java.util.Arrays;
-public class Curve25519Test extends AndroidTestCase {
+public class Curve25519Test extends TestCase {
public void testAgreement() throws InvalidKeyException {
-
byte[] alicePublic = {(byte) 0x05, (byte) 0x1b, (byte) 0xb7, (byte) 0x59, (byte) 0x66,
(byte) 0xf2, (byte) 0xe9, (byte) 0x3a, (byte) 0x36, (byte) 0x91,
(byte) 0xdf, (byte) 0xff, (byte) 0x94, (byte) 0x2b, (byte) 0xb2,
@@ -138,17 +133,4 @@ public class Curve25519Test extends AndroidTestCase {
}
}
}
-
- public void testSignatureOverflow() throws InvalidKeyException {
- ECKeyPair keys = Curve.generateKeyPair();
- byte[] message = new byte[4096];
-
- try {
- byte[] signature = Curve.calculateSignature(keys.getPrivateKey(), message);
- throw new InvalidKeyException("Should have asserted!");
- } catch (AssertionError e) {
- // Success!
- }
- }
-
}
diff --git a/src/androidTest/java/org/whispersystems/test/groups/GroupCipherTest.java b/tests/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipherTest.java
index 6d93e921..7c9892b0 100644
--- a/src/androidTest/java/org/whispersystems/test/groups/GroupCipherTest.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipherTest.java
@@ -1,25 +1,20 @@
-package org.whispersystems.test.groups;
+package org.whispersystems.libaxolotl.groups;
-import android.test.AndroidTestCase;
-import android.util.Log;
+import junit.framework.TestCase;
import org.whispersystems.libaxolotl.DuplicateMessageException;
import org.whispersystems.libaxolotl.InvalidMessageException;
import org.whispersystems.libaxolotl.LegacyMessageException;
import org.whispersystems.libaxolotl.NoSessionException;
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
-import org.whispersystems.libaxolotl.groups.GroupCipher;
-import org.whispersystems.libaxolotl.groups.GroupSessionBuilder;
import org.whispersystems.libaxolotl.protocol.SenderKeyDistributionMessage;
import org.whispersystems.libaxolotl.util.KeyHelper;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-public class GroupCipherTest extends AndroidTestCase {
+public class GroupCipherTest extends TestCase {
public void testBasicEncryptDecrypt()
throws LegacyMessageException, DuplicateMessageException, InvalidMessageException, NoSessionException
diff --git a/src/androidTest/java/org/whispersystems/test/groups/InMemorySenderKeyStore.java b/tests/src/main/java/org/whispersystems/libaxolotl/groups/InMemorySenderKeyStore.java
index 450d802d..c012566a 100644
--- a/src/androidTest/java/org/whispersystems/test/groups/InMemorySenderKeyStore.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/groups/InMemorySenderKeyStore.java
@@ -1,4 +1,4 @@
-package org.whispersystems.test.groups;
+package org.whispersystems.libaxolotl.groups;
import org.whispersystems.libaxolotl.groups.state.SenderKeyRecord;
import org.whispersystems.libaxolotl.groups.state.SenderKeyStore;
diff --git a/src/androidTest/java/org/whispersystems/test/kdf/HKDFTest.java b/tests/src/main/java/org/whispersystems/libaxolotl/kdf/HKDFTest.java
index 079bc4fa..4cf7166a 100644
--- a/src/androidTest/java/org/whispersystems/test/kdf/HKDFTest.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/kdf/HKDFTest.java
@@ -1,12 +1,10 @@
-package org.whispersystems.test.kdf;
+package org.whispersystems.libaxolotl.kdf;
-import android.test.AndroidTestCase;
-
-import org.whispersystems.libaxolotl.kdf.HKDF;
+import junit.framework.TestCase;
import java.util.Arrays;
-public class HKDFTest extends AndroidTestCase {
+public class HKDFTest extends TestCase {
public void testVectorV3() {
byte[] ikm = {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
diff --git a/src/androidTest/java/org/whispersystems/test/ratchet/ChainKeyTest.java b/tests/src/main/java/org/whispersystems/libaxolotl/ratchet/ChainKeyTest.java
index 1197f3eb..ad17ebb9 100644
--- a/src/androidTest/java/org/whispersystems/test/ratchet/ChainKeyTest.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/ratchet/ChainKeyTest.java
@@ -1,14 +1,13 @@
-package org.whispersystems.test.ratchet;
+package org.whispersystems.libaxolotl.ratchet;
-import android.test.AndroidTestCase;
+import junit.framework.TestCase;
import org.whispersystems.libaxolotl.kdf.HKDF;
-import org.whispersystems.libaxolotl.ratchet.ChainKey;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
-public class ChainKeyTest extends AndroidTestCase {
+public class ChainKeyTest extends TestCase {
public void testChainKeyDerivationV2() throws NoSuchAlgorithmException {
diff --git a/src/androidTest/java/org/whispersystems/test/ratchet/RatchetingSessionTest.java b/tests/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionTest.java
index 311aff90..93929455 100644
--- a/src/androidTest/java/org/whispersystems/test/ratchet/RatchetingSessionTest.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/ratchet/RatchetingSessionTest.java
@@ -1,7 +1,6 @@
-package org.whispersystems.test.ratchet;
+package org.whispersystems.libaxolotl.ratchet;
-import android.test.AndroidTestCase;
-import android.util.Log;
+import junit.framework.TestCase;
import org.whispersystems.libaxolotl.IdentityKey;
import org.whispersystems.libaxolotl.IdentityKeyPair;
@@ -10,16 +9,12 @@ import org.whispersystems.libaxolotl.ecc.Curve;
import org.whispersystems.libaxolotl.ecc.ECKeyPair;
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
-import org.whispersystems.libaxolotl.ratchet.AliceAxolotlParameters;
-import org.whispersystems.libaxolotl.ratchet.BobAxolotlParameters;
-import org.whispersystems.libaxolotl.ratchet.RatchetingSession;
import org.whispersystems.libaxolotl.state.SessionState;
-import org.whispersystems.libaxolotl.util.Hex;
import org.whispersystems.libaxolotl.util.guava.Optional;
import java.util.Arrays;
-public class RatchetingSessionTest extends AndroidTestCase {
+public class RatchetingSessionTest extends TestCase {
public void testRatchetingSessionAsBob() throws InvalidKeyException {
byte[] bobPublic = {(byte) 0x05, (byte) 0x2c, (byte) 0xb4, (byte) 0x97,
diff --git a/src/androidTest/java/org/whispersystems/test/ratchet/RootKeyTest.java b/tests/src/main/java/org/whispersystems/libaxolotl/ratchet/RootKeyTest.java
index c48ef23d..008c7b40 100644
--- a/src/androidTest/java/org/whispersystems/test/ratchet/RootKeyTest.java
+++ b/tests/src/main/java/org/whispersystems/libaxolotl/ratchet/RootKeyTest.java
@@ -1,6 +1,6 @@
-package org.whispersystems.test.ratchet;
+package org.whispersystems.libaxolotl.ratchet;
-import android.test.AndroidTestCase;
+import junit.framework.TestCase;
import org.whispersystems.libaxolotl.InvalidKeyException;
import org.whispersystems.libaxolotl.ecc.Curve;
@@ -8,14 +8,12 @@ import org.whispersystems.libaxolotl.ecc.ECKeyPair;
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
import org.whispersystems.libaxolotl.kdf.HKDF;
-import org.whispersystems.libaxolotl.ratchet.ChainKey;
-import org.whispersystems.libaxolotl.ratchet.RootKey;
import org.whispersystems.libaxolotl.util.Pair;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
-public class RootKeyTest extends AndroidTestCase {
+public class RootKeyTest extends TestCase {
public void testRootKeyDerivationV2() throws NoSuchAlgorithmException, InvalidKeyException {
byte[] rootKeySeed = {(byte) 0x7b, (byte) 0xa6, (byte) 0xde, (byte) 0xbc, (byte) 0x2b,