public byte[] getSalt() throws NoSuchAlgorithmException { byte[] salt = RandomUtil.randomBytes(this.saltLength); return salt; }
public byte[] getSalt() throws NoSuchAlgorithmException { byte[] salt = RandomUtil.randomBytes(this.saltLength); return salt; }
public byte[] getSalt() throws NoSuchAlgorithmException { byte[] salt = RandomUtil.randomBytes(this.saltLength); return salt; }
public byte[] getSalt() throws NoSuchAlgorithmException { byte[] salt = RandomUtil.randomBytes(this.saltLength); return salt; }
public byte[] getSalt() throws NoSuchAlgorithmException { byte[] salt = RandomUtil.randomBytes(this.saltLength); return salt; }
public byte[] getSalt() throws NoSuchAlgorithmException { byte[] salt = RandomUtil.randomBytes(this.saltLength); return salt; }
public byte[] getSalt() throws NoSuchAlgorithmException { byte[] salt = RandomUtil.randomBytes(this.saltLength); return salt; }
@Test public void testWriteObjectWithBytes() throws Exception { final byte[] value = RandomUtil.randomBytes(); doWriteObjectWithType(value, new TypeReader() { @Override public Object readType(final ActiveMQStreamMessage message) throws Exception { byte[] bytes = new byte[value.length]; message.readBytes(bytes); return bytes; } }); }
@Test public void testSetObjectFromBytes() throws Exception { doTestSetObject(RandomUtil.randomBytes()); }
@Test public void testBytesWithLength() throws Exception { byte[] bytes = RandomUtil.randomBytes(); // put only half of the bytes wrapper.writeBytes(bytes, 0, bytes.length / 2); byte[] b = new byte[bytes.length / 2]; wrapper.readBytes(b, 0, b.length); ActiveMQTestBase.assertEqualsByteArrays(b.length, bytes, b); }
@Test public void testBytes() throws Exception { byte[] bytes = RandomUtil.randomBytes(); wrapper.writeBytes(bytes); byte[] b = new byte[bytes.length]; wrapper.readBytes(b); ActiveMQTestBase.assertEqualsByteArrays(bytes, b); }
@Test public void testArray() throws Exception { byte[] bytes = RandomUtil.randomBytes(128); wrapper.writeBytes(bytes); byte[] array = wrapper.toByteBuffer().array(); Assert.assertEquals(wrapper.capacity(), array.length); ActiveMQTestBase.assertEqualsByteArrays(128, bytes, wrapper.toByteBuffer().array()); }
@Test public void testRemaining() throws Exception { int capacity = wrapper.capacity(); // fill 1/3 of the buffer int fill = capacity / 3; byte[] bytes = RandomUtil.randomBytes(fill); wrapper.writeBytes(bytes); // check the remaining is 2/3 Assert.assertEquals(capacity - fill, wrapper.writableBytes()); }
@Test public void testGetBytesFromBytes() throws Exception { byte[] value = RandomUtil.randomBytes(); ActiveMQMapMessage message = new ActiveMQMapMessage(); message.setBytes(itemName, value); ActiveMQTestBase.assertEqualsByteArrays(value, message.getBytes(itemName)); }
@Test public void testDuplicateNonPersistent() throws Exception { createStorage(); DuplicateIDCache cache = new DuplicateIDCacheImpl(new SimpleString("test"), 2000, journal, false); TransactionImpl tx = new TransactionImpl(journal); for (int i = 0; i < 5000; i++) { byte[] bytes = RandomUtil.randomBytes(); cache.addToCache(bytes, tx); } tx.commit(); for (int i = 0; i < 5000; i++) { byte[] bytes = RandomUtil.randomBytes(); cache.addToCache(bytes, null); } } }
@Test public void testReadBytesFromBytes_2() throws Exception { byte[] value = RandomUtil.randomBytes(512); ActiveMQStreamMessage message = new ActiveMQStreamMessage(); message.writeBytes(value, 0, 256); message.reset(); byte[] v = new byte[256]; message.readBytes(v); ActiveMQTestBase.assertEqualsByteArrays(256, value, v); }
@Test public void testReadBytesFromBytes() throws Exception { byte[] value = RandomUtil.randomBytes(); ActiveMQStreamMessage message = new ActiveMQStreamMessage(); message.writeBytes(value); message.reset(); byte[] v = new byte[value.length]; message.readBytes(v); ActiveMQTestBase.assertEqualsByteArrays(value, v); }
@Test public void testReadObjectFromBytes() throws Exception { byte[] value = RandomUtil.randomBytes(); ActiveMQStreamMessage message = new ActiveMQStreamMessage(); message.writeBytes(value); message.reset(); byte[] v = (byte[]) message.readObject(); ActiveMQTestBase.assertEqualsByteArrays(value, v); }
@Test public void testPosition() throws Exception { Assert.assertEquals(0, wrapper.writerIndex()); byte[] bytes = RandomUtil.randomBytes(128); wrapper.writeBytes(bytes); Assert.assertEquals(bytes.length, wrapper.writerIndex()); wrapper.writerIndex(0); Assert.assertEquals(0, wrapper.writerIndex()); }
@Test public void testBytesProperty() throws Exception { byte[] val = RandomUtil.randomBytes(); props.putBytesProperty(key, val); Assert.assertArrayEquals(val, props.getBytesProperty(key)); try { props.putBooleanProperty(key, RandomUtil.randomBoolean()); props.getBytesProperty(key); Assert.fail(); } catch (ActiveMQPropertyConversionException e) { } Assert.assertNull(props.getBytesProperty(unknownKey)); }