mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
[sinttest] XEP-0373 Integration Tests should clean-up
After test execution, the OpenPGP for XMPP integration tests should clean up the data published via PEP. This prevents these tests from interfering with other tests.
This commit is contained in:
parent
d27fef0bae
commit
59706d0294
2 changed files with 48 additions and 34 deletions
|
@ -38,6 +38,7 @@ import org.jivesoftware.smackx.ox.exception.MissingUserIdOnKeyException;
|
|||
import org.jivesoftware.smackx.ox.exception.NoBackupFoundException;
|
||||
import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
|
||||
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
|
||||
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
|
||||
import org.jivesoftware.smackx.pubsub.PubSubException;
|
||||
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
|
@ -122,8 +123,9 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration
|
|||
assertNull(self.getSigningKeyFingerprint());
|
||||
|
||||
OpenPgpV4Fingerprint keyFingerprint = openPgpManager.generateAndImportKeyPair(alice);
|
||||
assertEquals(keyFingerprint, self.getSigningKeyFingerprint());
|
||||
|
||||
try {
|
||||
assertEquals(keyFingerprint, self.getSigningKeyFingerprint());
|
||||
assertTrue(self.getSecretKeys().contains(keyFingerprint.getKeyId()));
|
||||
|
||||
PGPSecretKeyRing beforeSec = beforeStore.getSecretKeyRing(alice, keyFingerprint);
|
||||
|
@ -155,5 +157,9 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration
|
|||
PGPPublicKeyRing afterPub = afterStore.getPublicKeyRing(alice, keyFingerprint);
|
||||
assertNotNull(afterPub);
|
||||
assertArrayEquals(beforePub.getEncoded(), afterPub.getEncoded());
|
||||
} finally {
|
||||
OpenPgpPubSubUtil.deletePublicKeyNode(alicePepManager, keyFingerprint);
|
||||
OpenPgpPubSubUtil.deletePubkeysListNode(alicePepManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.jivesoftware.smackx.ox.OpenPgpManager;
|
|||
import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider;
|
||||
import org.jivesoftware.smackx.ox.element.SigncryptElement;
|
||||
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
|
||||
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
|
@ -139,6 +140,7 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio
|
|||
aliceFingerprint = aliceOpenPgp.generateAndImportKeyPair(alice);
|
||||
bobFingerprint = bobOpenPgp.generateAndImportKeyPair(bob);
|
||||
|
||||
try {
|
||||
aliceOpenPgp.announceSupportAndPublish();
|
||||
bobOpenPgp.announceSupportAndPublish();
|
||||
|
||||
|
@ -159,6 +161,12 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio
|
|||
aliceInstantMessaging.sendOxMessage(bobForAlice, body);
|
||||
|
||||
bobReceivedMessage.waitForResult(timeout);
|
||||
} finally {
|
||||
OpenPgpPubSubUtil.deletePublicKeyNode(alicePepManager, aliceFingerprint);
|
||||
OpenPgpPubSubUtil.deletePubkeysListNode(alicePepManager);
|
||||
OpenPgpPubSubUtil.deletePublicKeyNode(bobPepManager, bobFingerprint);
|
||||
OpenPgpPubSubUtil.deletePubkeysListNode(bobPepManager);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue