congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
RandomUtil.randomDouble
Code IndexAdd Tabnine to your IDE (free)

How to use
randomDouble
method
in
org.apache.activemq.artemis.utils.RandomUtil

Best Java code snippets using org.apache.activemq.artemis.utils.RandomUtil.randomDouble (Showing top 20 results out of 315)

origin: apache/activemq-artemis

@Test
public void testWriteObjectWithDouble() throws Exception {
 doWriteObjectWithType(RandomUtil.randomDouble(), new TypeReader() {
   @Override
   public Object readType(final ActiveMQStreamMessage message) throws Exception {
    return message.readDouble();
   }
 });
}
origin: apache/activemq-artemis

@Test
public void testSetObjectFromDouble() throws Exception {
 doTestSetObject(RandomUtil.randomDouble());
}
origin: apache/activemq-artemis

private void populate(StringBuilder sb,
           BeanUtilsBean bean,
           ActiveMQConnectionFactory factory) throws IllegalAccessException, InvocationTargetException {
 PropertyDescriptor[] descriptors = bean.getPropertyUtils().getPropertyDescriptors(factory);
 for (PropertyDescriptor descriptor : descriptors) {
   if (descriptor.getWriteMethod() != null && descriptor.getReadMethod() != null) {
    if (descriptor.getPropertyType() == String.class) {
      String value = RandomUtil.randomString();
      bean.setProperty(factory, descriptor.getName(), value);
      sb.append("&").append(descriptor.getName()).append("=").append(value);
    } else if (descriptor.getPropertyType() == int.class) {
      int value = RandomUtil.randomPositiveInt();
      bean.setProperty(factory, descriptor.getName(), value);
      sb.append("&").append(descriptor.getName()).append("=").append(value);
    } else if (descriptor.getPropertyType() == long.class) {
      long value = RandomUtil.randomPositiveLong();
      bean.setProperty(factory, descriptor.getName(), value);
      sb.append("&").append(descriptor.getName()).append("=").append(value);
    } else if (descriptor.getPropertyType() == double.class) {
      double value = RandomUtil.randomDouble();
      bean.setProperty(factory, descriptor.getName(), value);
      sb.append("&").append(descriptor.getName()).append("=").append(value);
    }
   }
 }
}
origin: apache/activemq-artemis

 value = RandomUtil.randomBoolean();
} else if (prop.getPropertyType() == Double.class || prop.getPropertyType() == Double.TYPE) {
 value = RandomUtil.randomDouble();
} else {
 System.out.println("Can't validate property of type " + prop.getPropertyType() + " on " + prop.getName());
origin: apache/activemq-artemis

@Test
public void testGetDoubleFromString() throws Exception {
 double value = RandomUtil.randomDouble();
 ActiveMQMapMessage message = new ActiveMQMapMessage();
 message.setString(itemName, Double.toString(value));
 Assert.assertEquals(value, message.getDouble(itemName), 0.000001);
}
origin: apache/activemq-artemis

@Test
public void testDouble() throws Exception {
 double d = RandomUtil.randomDouble();
 wrapper.writeDouble(d);
 Assert.assertEquals(d, wrapper.readDouble(), 0.000001);
}
origin: apache/activemq-artemis

@Test
public void testReadStringFromDouble() throws Exception {
 double value = RandomUtil.randomDouble();
 ActiveMQStreamMessage message = new ActiveMQStreamMessage();
 message.writeDouble(value);
 message.reset();
 Assert.assertEquals(Double.toString(value), message.readString());
}
origin: apache/activemq-artemis

@Test
public void testReadDoubleFromString() throws Exception {
 double value = RandomUtil.randomDouble();
 ActiveMQStreamMessage message = new ActiveMQStreamMessage();
 message.writeString(Double.toString(value));
 message.reset();
 Assert.assertEquals(value, message.readDouble(), 0.000001);
}
origin: apache/activemq-artemis

@Test
public void testGetDoubleFromDouble() throws Exception {
 double value = RandomUtil.randomDouble();
 ActiveMQMapMessage message = new ActiveMQMapMessage();
 message.setDouble(itemName, value);
 Assert.assertEquals(value, message.getDouble(itemName), 0.000001);
}
origin: apache/activemq-artemis

@Test
public void testReadDoubleFromDouble() throws Exception {
 double value = RandomUtil.randomDouble();
 ActiveMQStreamMessage message = new ActiveMQStreamMessage();
 message.writeDouble(value);
 message.reset();
 Assert.assertEquals(value, message.readDouble(), 0.000001);
}
origin: apache/activemq-artemis

@Test
public void testReadObjectFromDouble() throws Exception {
 double value = RandomUtil.randomDouble();
 ActiveMQStreamMessage message = new ActiveMQStreamMessage();
 message.writeDouble(value);
 message.reset();
 Assert.assertEquals(value, message.readObject());
}
origin: apache/activemq-artemis

@Test
public void testDoubleProperty() throws Exception {
 Double val = RandomUtil.randomDouble();
 props.putDoubleProperty(key, val);
 Assert.assertEquals(val, props.getDoubleProperty(key));
 Assert.assertEquals(new SimpleString(Double.toString(val)), props.getSimpleStringProperty(key));
 props.putSimpleStringProperty(key, new SimpleString(Double.toString(val)));
 Assert.assertEquals(val, props.getDoubleProperty(key));
 try {
   props.putBooleanProperty(key, RandomUtil.randomBoolean());
   props.getDoubleProperty(key);
   Assert.fail();
 } catch (ActiveMQPropertyConversionException e) {
 }
 try {
   props.getDoubleProperty(unknownKey);
   Assert.fail();
 } catch (Exception e) {
 }
}
origin: apache/activemq-artemis

@Test
public void testReadData() throws Exception {
 ActiveMQBuffer dynamic = ActiveMQBuffers.dynamicBuffer(1);
 String str1 = RandomUtil.randomString();
 String str2 = RandomUtil.randomString();
 double d1 = RandomUtil.randomDouble();
 float f1 = RandomUtil.randomFloat();
 dynamic.writeUTF(str1);
 dynamic.writeString(str2);
 dynamic.writeDouble(d1);
 dynamic.writeFloat(f1);
 LargeMessageControllerImpl readBuffer = splitBuffer(3, dynamic.toByteBuffer().array());
 Assert.assertEquals(str1, readBuffer.readUTF());
 Assert.assertEquals(str2, readBuffer.readString());
 Assert.assertEquals(d1, readBuffer.readDouble(), 0.000001);
 Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001);
}
origin: apache/activemq-artemis

@Override
@Before
public void setUp() throws Exception {
 super.setUp();
 Map<String, Object> acceptorParams = new HashMap<>();
 acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
 TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
 TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
 CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
 CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
 List<String> connectors = new ArrayList<>();
 connectors.add(connectorConfig.getName());
 Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(targetQueueConfig);
 bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName()).setForwardingAddress(targetQueueConfig.getAddress()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors).setPassword(CLUSTER_PASSWORD);
 Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addQueueConfiguration(sourceQueueConfig).addBridgeConfiguration(bridgeConfig);
 server_1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, MBeanServerFactory.createMBeanServer(), false));
 addServer(server_1);
 server_1.start();
 server_0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false));
 addServer(server_0);
 server_0.start();
}
origin: apache/activemq-artemis

@Override
@Before
public void setUp() throws Exception {
 super.setUp();
 Map<String, Object> acceptorParams = new HashMap<>();
 acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
 TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
 TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
 CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
 CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
 List<String> connectors = new ArrayList<>();
 connectors.add(connectorConfig.getName());
 bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName()).setForwardingAddress(targetQueueConfig.getAddress()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors);
 Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(targetQueueConfig);
 Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addQueueConfiguration(sourceQueueConfig).addBridgeConfiguration(bridgeConfig);
 server_1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, MBeanServerFactory.createMBeanServer(), false));
 server_1.start();
 server_0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false));
 server_0.start();
}
origin: apache/activemq-artemis

@Test
public void testReadDataOverCached() throws Exception {
 clearDataRecreateServerDirs();
 ActiveMQBuffer dynamic = ActiveMQBuffers.dynamicBuffer(1);
 String str1 = RandomUtil.randomString();
 String str2 = RandomUtil.randomString();
 double d1 = RandomUtil.randomDouble();
 float f1 = RandomUtil.randomFloat();
 dynamic.writeUTF(str1);
 dynamic.writeString(str2);
 dynamic.writeDouble(d1);
 dynamic.writeFloat(f1);
 LargeMessageControllerImpl readBuffer = splitBuffer(3, dynamic.toByteBuffer().array(), getTestFile());
 Assert.assertEquals(str1, readBuffer.readUTF());
 Assert.assertEquals(str2, readBuffer.readString());
 Assert.assertEquals(d1, readBuffer.readDouble(), 0.00000001);
 Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001);
 readBuffer.readerIndex(0);
 Assert.assertEquals(str1, readBuffer.readUTF());
 Assert.assertEquals(str2, readBuffer.readString());
 Assert.assertEquals(d1, readBuffer.readDouble(), 0.00000001);
 Assert.assertEquals(f1, readBuffer.readFloat(), 0.000001);
 readBuffer.close();
}
origin: apache/activemq-artemis

@Test
public void testEncodeDecode() throws Exception {
 props.putByteProperty(RandomUtil.randomSimpleString(), RandomUtil.randomByte());
 props.putBytesProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBytes());
 props.putBytesProperty(RandomUtil.randomSimpleString(), null);
 props.putBooleanProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBoolean());
 props.putShortProperty(RandomUtil.randomSimpleString(), RandomUtil.randomShort());
 props.putIntProperty(RandomUtil.randomSimpleString(), RandomUtil.randomInt());
 props.putLongProperty(RandomUtil.randomSimpleString(), RandomUtil.randomLong());
 props.putFloatProperty(RandomUtil.randomSimpleString(), RandomUtil.randomFloat());
 props.putDoubleProperty(RandomUtil.randomSimpleString(), RandomUtil.randomDouble());
 props.putCharProperty(RandomUtil.randomSimpleString(), RandomUtil.randomChar());
 props.putSimpleStringProperty(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString());
 props.putSimpleStringProperty(RandomUtil.randomSimpleString(), null);
 SimpleString keyToRemove = RandomUtil.randomSimpleString();
 props.putSimpleStringProperty(keyToRemove, RandomUtil.randomSimpleString());
 ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
 props.encode(buffer.byteBuf());
 Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
 TypedProperties decodedProps = new TypedProperties();
 decodedProps.decode(buffer.byteBuf());
 TypedPropertiesTest.assertEqualsTypeProperties(props, decodedProps);
 buffer.clear();
 // After removing a property, you should still be able to encode the Property
 props.removeProperty(keyToRemove);
 props.encode(buffer.byteBuf());
 Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
}
origin: apache/activemq-artemis

int threadPoolMaxSize = RandomUtil.randomPositiveInt();
long retryInterval = RandomUtil.randomPositiveLong();
double retryIntervalMultiplier = RandomUtil.randomDouble();
int reconnectAttempts = RandomUtil.randomPositiveInt();
factory.setClientID(clientID);
origin: apache/activemq-artemis

int threadPoolMaxSize = RandomUtil.randomPositiveInt();
long retryInterval = RandomUtil.randomPositiveLong();
double retryIntervalMultiplier = RandomUtil.randomDouble();
int reconnectAttempts = RandomUtil.randomPositiveInt();
TransportConfiguration[] tc = new TransportConfiguration[]{liveTC};
origin: apache/activemq-artemis

int threadPoolMaxSize = RandomUtil.randomPositiveInt();
long retryInterval = RandomUtil.randomPositiveLong();
double retryIntervalMultiplier = RandomUtil.randomDouble();
int reconnectAttempts = RandomUtil.randomPositiveInt();
cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
org.apache.activemq.artemis.utilsRandomUtilrandomDouble

Popular methods of RandomUtil

  • randomInt
  • randomLong
  • randomString
  • randomByte
  • randomBytes
  • randomPositiveInt
  • randomInterval
  • randomBoolean
  • randomSimpleString
  • randomChar
  • randomPositiveLong
  • randomFloat
  • randomPositiveLong,
  • randomFloat,
  • randomShort,
  • getRandom,
  • randomBuffer

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Runner (org.openjdk.jmh.runner)
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now