Tabnine Logo
ConfigurationValue
Code IndexAdd Tabnine to your IDE (free)

How to use
ConfigurationValue
in
org.finra.herd.model.dto

Best Java code snippets using org.finra.herd.model.dto.ConfigurationValue (Showing top 20 results out of 315)

origin: org.finra.herd/herd-service

/**
 * Get the message definition key based on the event type
 *
 * @param notificationEvent the notification event
 *
 * @return the message definition key
 */
private String getMessageDefinitionKey(NotificationEvent notificationEvent)
{
  return eventTypeMessageDefinitionKeyMap.get(notificationEvent.getClass()).getKey();
}
origin: FINRAOS/herd

@Test
public void testGetPropertyReturnDefaultWhenPropertyDoesNotExists()
{
  ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
  String expectedValue = (String) configurationValue.getDefaultValue();
  MockEnvironment environment = new MockEnvironment();
  environment.setProperty(configurationValue.getKey(), expectedValue);
  String value = ConfigurationHelper.getProperty(configurationValue, String.class, environment);
  assertNotNull("value", value);
  assertEquals("value", expectedValue, value);
}
origin: FINRAOS/herd

@Test
public void testGetPropertyInstanceNoTargetType()
{
  ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
  String value = configurationHelper.getProperty(configurationValue);
  assertEquals("value", configurationValue.getDefaultValue(), value);
}
origin: FINRAOS/herd

@Test
public void testGetPropertyReturnDefaultWhenValueConversionFails() throws Exception
{
  ConfigurationValue configurationValue = ConfigurationValue.BUSINESS_OBJECT_DATA_GET_ALL_MAX_RESULT_COUNT;
  Integer expectedValue = (Integer) configurationValue.getDefaultValue();
  MockEnvironment environment = new MockEnvironment();
  environment.setProperty(configurationValue.getKey(), "NOT_AN_INTEGER");
  executeWithoutLogging(ConfigurationHelper.class, () ->
  {
    Integer value = ConfigurationHelper.getProperty(configurationValue, Integer.class, environment);
    assertNotNull("value", value);
    assertEquals("value", expectedValue, value);
  });
}
origin: FINRAOS/herd

@Test
public void testGetRequiredProperty()
{
  ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
  String value = configurationHelper.getRequiredProperty(configurationValue);
  assertEquals(configurationValue.getDefaultValue(), value);
}
origin: FINRAOS/herd

/**
 * Get the message definition key based on the event type
 *
 * @param notificationEvent the notification event
 *
 * @return the message definition key
 */
private String getMessageDefinitionKey(NotificationEvent notificationEvent)
{
  return eventTypeMessageDefinitionKeyMap.get(notificationEvent.getClass()).getKey();
}
origin: FINRAOS/herd

@Test
public void testGetPropertyInstance()
{
  ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
  String value = configurationHelper.getProperty(configurationValue, String.class);
  assertEquals("value", configurationValue.getDefaultValue(), value);
}
origin: org.finra.herd/herd-core

  /**
   * Logs the error message, and then throws {@link IllegalStateException}
   *
   * @param configurationValue - {@link ConfigurationValue}
   * @param targetTypeName - the name of the data type we want to convert the configuration value to(boolean, BigDecimal...etc)
   * @param stringValue - the configuration value in string type
   * @param exception - the exception thrown when converting the configuration value from string type to the target data type
   */
  private void logErrorAndThrowIllegalStateException(ConfigurationValue configurationValue, String targetTypeName, String stringValue, Exception exception)
  {
    // Create an invalid state exception.
    IllegalStateException illegalStateException = new IllegalStateException(
      String.format("Configuration \"%s\" has an invalid %s value: \"%s\".", configurationValue.getKey(), targetTypeName, stringValue), exception);

    // Log the exception.
    LOGGER.error(illegalStateException.getMessage(), illegalStateException);
    // This will produce a 500 HTTP status code error.
    throw illegalStateException;
  }
}
origin: FINRAOS/herd

@Test
public void testGetPropertyNoTargetType()
{
  ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
  MockEnvironment environment = new MockEnvironment();
  String value = ConfigurationHelper.getProperty(configurationValue, environment);
  assertEquals("value", configurationValue.getDefaultValue(), value);
}
origin: FINRAOS/herd

  /**
   * Logs the error message, and then throws {@link IllegalStateException}
   *
   * @param configurationValue - {@link ConfigurationValue}
   * @param targetTypeName - the name of the data type we want to convert the configuration value to(boolean, BigDecimal...etc)
   * @param stringValue - the configuration value in string type
   * @param exception - the exception thrown when converting the configuration value from string type to the target data type
   */
  private void logErrorAndThrowIllegalStateException(ConfigurationValue configurationValue, String targetTypeName, String stringValue, Exception exception)
  {
    // Create an invalid state exception.
    IllegalStateException illegalStateException = new IllegalStateException(
      String.format("Configuration \"%s\" has an invalid %s value: \"%s\".", configurationValue.getKey(), targetTypeName, stringValue), exception);

    // Log the exception.
    LOGGER.error(illegalStateException.getMessage(), illegalStateException);
    // This will produce a 500 HTTP status code error.
    throw illegalStateException;
  }
}
origin: FINRAOS/herd

@Test
public void testGetPropertyThrowsWhenDefaultTypeDoesNotMatch()
{
  ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
  Class<?> expectedDefaultType = configurationValue.getDefaultValue().getClass();
  Class<?> givenType = Integer.class;
  MockEnvironment environment = new MockEnvironment();
  try
  {
    ConfigurationHelper.getProperty(configurationValue, givenType, environment);
    fail("expected IllegalArgumentException, but no exception was thrown");
  }
  catch (Exception e)
  {
    assertEquals("thrown exception type", IllegalStateException.class, e.getClass());
    assertEquals("thrown exception message",
      "targetType \"" + givenType + "\" is not assignable from the default value of type \"" + expectedDefaultType + "\" for configuration value " +
        "\"HERD_ENVIRONMENT\".", e.getMessage());
  }
}
origin: org.finra.herd/herd-service

@Override
public void validateParameters(List<Parameter> parameters)
{
  // This system job accepts only one optional parameter.
  if (!org.springframework.util.CollectionUtils.isEmpty(parameters))
  {
    Assert.isTrue(parameters.size() == 1, String.format("Too many parameters are specified for \"%s\" system job.", JOB_NAME));
    Assert.isTrue(parameters.get(0).getName().equalsIgnoreCase(ConfigurationValue.EC2_ON_DEMAND_PRICING_UPDATE_JOB_EC2_PRICING_LIST_URL.getKey()),
      String.format("Parameter \"%s\" is not supported by \"%s\" system job.", parameters.get(0).getName(), JOB_NAME));
  }
}
origin: FINRAOS/herd

@Override
public void validateParameters(List<Parameter> parameters)
{
  // This system job accepts only one optional parameter.
  if (!org.springframework.util.CollectionUtils.isEmpty(parameters))
  {
    Assert.isTrue(parameters.size() == 1, String.format("Too many parameters are specified for \"%s\" system job.", JOB_NAME));
    Assert.isTrue(parameters.get(0).getName().equalsIgnoreCase(ConfigurationValue.EC2_ON_DEMAND_PRICING_UPDATE_JOB_EC2_PRICING_LIST_URL.getKey()),
      String.format("Parameter \"%s\" is not supported by \"%s\" system job.", parameters.get(0).getName(), JOB_NAME));
  }
}
origin: org.finra.herd/herd-service

/**
 * Returns the SQS queue name. Throws {@link IllegalStateException} if SQS queue name is undefined.
 *
 * @return the sqs queue name
 */
private String getSqsQueueName()
{
  String sqsQueueName = configurationHelper.getProperty(ConfigurationValue.SEARCH_INDEX_UPDATE_SQS_QUEUE_NAME);
  if (StringUtils.isBlank(sqsQueueName))
  {
    throw new IllegalStateException(String.format("SQS queue name not found. Ensure the \"%s\" configuration entry is configured.",
      ConfigurationValue.SEARCH_INDEX_UPDATE_SQS_QUEUE_NAME.getKey()));
  }
  return sqsQueueName;
}
origin: FINRAOS/herd

/**
 * Returns the SQS queue name. Throws {@link IllegalStateException} if SQS queue name is undefined.
 *
 * @return the sqs queue name
 */
private String getSqsQueueName()
{
  String sqsQueueName = configurationHelper.getProperty(ConfigurationValue.SEARCH_INDEX_UPDATE_SQS_QUEUE_NAME);
  if (StringUtils.isBlank(sqsQueueName))
  {
    throw new IllegalStateException(String.format("SQS queue name not found. Ensure the \"%s\" configuration entry is configured.",
      ConfigurationValue.SEARCH_INDEX_UPDATE_SQS_QUEUE_NAME.getKey()));
  }
  return sqsQueueName;
}
origin: org.finra.herd/herd-service

  /**
   * The quartz driver delegate class, that works with the quartz database. Throws {@link IllegalStateException} if undefined.
   *
   * @return the quartz driver delegate class.
   */
  private String getQuartzDatabaseDelegateClass()
  {
    String quartzDelegateClass = configurationHelper.getProperty(ConfigurationValue.QUARTZ_JOBSTORE_DRIVER_DELEGATE_CLASS);

    if (StringUtils.isBlank(quartzDelegateClass))
    {
      throw new IllegalStateException(String.format("Quartz driver delegate class name not found. Ensure the \"%s\" configuration entry is configured.",
        ConfigurationValue.QUARTZ_JOBSTORE_DRIVER_DELEGATE_CLASS.getKey()));
    }

    return quartzDelegateClass;
  }
}
origin: org.finra.herd/herd-dao

/**
 * Gets the value and verifies that it is not blank for the given configuration option.
 *
 * @param configurationValue the configuration option
 *
 * @return the configuration option value
 */
public String getRequiredConfigurationValue(ConfigurationValue configurationValue)
{
  String value = configurationHelper.getProperty(configurationValue);
  if (StringUtils.isBlank(value))
  {
    throw new IllegalStateException(String.format("Missing configuration parameter value for key \"%s\".", configurationValue.getKey()));
  }
  return value;
}
origin: org.finra.herd/herd-service

@Override
public void validateParameters(List<Parameter> parameters)
{
  // This system job accepts only one optional parameter with an integer value.
  if (!CollectionUtils.isEmpty(parameters))
  {
    Assert.isTrue(parameters.size() == 1, String.format("Too many parameters are specified for \"%s\" system job.", JOB_NAME));
    Assert.isTrue(parameters.get(0).getName().equalsIgnoreCase(ConfigurationValue.CLEANUP_DESTROYED_BDATA_JOB_MAX_BDATA_INSTANCES.getKey()),
      String.format("Parameter \"%s\" is not supported by \"%s\" system job.", parameters.get(0).getName(), JOB_NAME));
    parameterHelper.getParameterValueAsInteger(parameters.get(0));
  }
}
origin: FINRAOS/herd

  /**
   * The quartz driver delegate class, that works with the quartz database. Throws {@link IllegalStateException} if undefined.
   *
   * @return the quartz driver delegate class.
   */
  private String getQuartzDatabaseDelegateClass()
  {
    String quartzDelegateClass = configurationHelper.getProperty(ConfigurationValue.QUARTZ_JOBSTORE_DRIVER_DELEGATE_CLASS);

    if (StringUtils.isBlank(quartzDelegateClass))
    {
      throw new IllegalStateException(String.format("Quartz driver delegate class name not found. Ensure the \"%s\" configuration entry is configured.",
        ConfigurationValue.QUARTZ_JOBSTORE_DRIVER_DELEGATE_CLASS.getKey()));
    }

    return quartzDelegateClass;
  }
}
origin: FINRAOS/herd

/**
 * Gets the value and verifies that it is not blank for the given configuration option.
 *
 * @param configurationValue the configuration option
 *
 * @return the configuration option value
 */
public String getRequiredConfigurationValue(ConfigurationValue configurationValue)
{
  String value = configurationHelper.getProperty(configurationValue);
  if (StringUtils.isBlank(value))
  {
    throw new IllegalStateException(String.format("Missing configuration parameter value for key \"%s\".", configurationValue.getKey()));
  }
  return value;
}
org.finra.herd.model.dtoConfigurationValue

Javadoc

An enum that lists the configuration values keys and their default values.

Most used methods

  • getKey
  • getDefaultValue

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • scheduleAtFixedRate (Timer)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JCheckBox (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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