Search in sources :

Example 1 with DigestFactory

use of org.xwiki.crypto.DigestFactory in project xwiki-platform by xwiki.

the class SignedMacroBlockReferenceResolverTest method setUp.

@Before
public void setUp() throws Exception {
    DigestFactory digestFactory = mocker.getInstance(DigestFactory.class, "SHA-1");
    BinaryStringEncoder encoder = mocker.getInstance(BinaryStringEncoder.class, "Base64");
    dumper = mocker.getInstance(BlockDumper.class, "macro");
    Digest digest = mock(Digest.class);
    stream = new ByteArrayOutputStream();
    when(digest.getOutputStream()).thenReturn(stream);
    when(digest.digest()).thenReturn(DIGEST_BLOCK);
    when(digestFactory.getInstance()).thenReturn(digest);
    when(encoder.encode(DIGEST_BLOCK)).thenReturn(ENCODED);
}
Also used : BinaryStringEncoder(org.xwiki.crypto.BinaryStringEncoder) DigestFactory(org.xwiki.crypto.DigestFactory) BlockDumper(org.xwiki.rendering.signature.internal.BlockDumper) Digest(org.xwiki.crypto.Digest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Before(org.junit.Before)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Before (org.junit.Before)1 BinaryStringEncoder (org.xwiki.crypto.BinaryStringEncoder)1 Digest (org.xwiki.crypto.Digest)1 DigestFactory (org.xwiki.crypto.DigestFactory)1 BlockDumper (org.xwiki.rendering.signature.internal.BlockDumper)1