Codota Logo
PolicyConfigurator.sync
Code IndexAdd Codota to your IDE (free)

How to use
sync
method
in
com.ocadotechnology.newrelic.alertsconfigurator.PolicyConfigurator

Best Java code snippets using com.ocadotechnology.newrelic.alertsconfigurator.PolicyConfigurator.sync (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: ocadotechnology/newrelic-alerts-configurator

@Test
public void shouldDoNothing_whenPolicyNotUpdated() {
  // given
  when(alertsPoliciesApiMock.getByName(POLICY_NAME)).thenReturn(Optional.of(ALERT_POLICY_SAME));
  // when
  testee.sync(CONFIGURATION);
  // then
  InOrder order = inOrder(alertsPoliciesApiMock);
  order.verify(alertsPoliciesApiMock).getByName(POLICY_NAME);
  order.verifyNoMoreInteractions();
}
origin: ocadotechnology/newrelic-alerts-configurator

@Test
public void shouldSynchronizeMoreThanOneConfigurations_whenMoreThanOneConfigurationsSet() {
  // given
  ApplicationConfiguration applicationConfigurationMock2 = mock(ApplicationConfiguration.class);
  PolicyConfiguration policyConfigurationMock2 = mock(PolicyConfiguration.class);
  testee.setApplicationConfigurations(ImmutableList.of(applicationConfigurationMock, applicationConfigurationMock2));
  testee.setPolicyConfigurations(ImmutableList.of(policyConfigurationMock, policyConfigurationMock2));
  // when
  testee.sync();
  // then
  InOrder order = inOrder(applicationConfiguratorMock,
      policyConfiguratorMock,
      conditionConfiguratorMock,
      externalServiceConditionConfiguratorMock,
      nrqlConditionConfiguratorMock,
      syntheticsConditionConfiguratorMock,
      channelConfiguratorMock);
  order.verify(applicationConfiguratorMock).sync(applicationConfigurationMock);
  order.verify(applicationConfiguratorMock).sync(applicationConfigurationMock2);
  order.verify(policyConfiguratorMock).sync(policyConfigurationMock);
  order.verify(policyConfiguratorMock).sync(policyConfigurationMock2);
}
origin: ocadotechnology/newrelic-alerts-configurator

/**
 * Synchronizes configurations (see {@link Configurator#setApplicationConfigurations(Collection)}
 * and {@link Configurator#setPolicyConfigurations(Collection)})
 */
public void sync() {
  for (ApplicationConfiguration applicationConfiguration : applicationConfigurations) {
    applicationConfigurator.sync(applicationConfiguration);
  }
  for (PolicyConfiguration configuration : policyConfigurations) {
    policyConfigurator.sync(configuration);
    conditionConfigurator.sync(configuration);
    externalServiceConditionConfigurator.sync(configuration);
    nrqlConditionConfigurator.sync(configuration);
    syntheticsConditionConfigurator.sync(configuration);
    channelConfigurator.sync(configuration);
  }
}
origin: ocadotechnology/newrelic-alerts-configurator

@Test
public void shouldCreateNewPolicy_whenPolicyDoesNotExist() {
  // given
  when(alertsPoliciesApiMock.getByName(POLICY_NAME)).thenReturn(Optional.empty());
  AlertsPolicy expectedPolicy = AlertsPolicy.builder().name(POLICY_NAME).incidentPreference(INCIDENT_PREFERENCE.name()).build();
  // when
  testee.sync(CONFIGURATION);
  // then
  InOrder order = inOrder(alertsPoliciesApiMock);
  order.verify(alertsPoliciesApiMock).getByName(POLICY_NAME);
  order.verify(alertsPoliciesApiMock).create(expectedPolicy);
  order.verifyNoMoreInteractions();
}
origin: ocadotechnology/newrelic-alerts-configurator

  @Test
  public void shouldSynchronizeAllConfigurationsForPolicy_whenFullPolicyConfiguration() {
    // given
    testee.setPolicyConfigurations(ImmutableList.of(policyConfigurationMock));

    // when
    testee.sync();

    // then
    InOrder order = inOrder(applicationConfiguratorMock,
        policyConfiguratorMock,
        conditionConfiguratorMock,
        externalServiceConditionConfiguratorMock,
        nrqlConditionConfiguratorMock,
        syntheticsConditionConfiguratorMock,
        channelConfiguratorMock);
    order.verify(policyConfiguratorMock).sync(policyConfigurationMock);
    order.verify(conditionConfiguratorMock).sync(policyConfigurationMock);
    order.verify(externalServiceConditionConfiguratorMock).sync(policyConfigurationMock);
    order.verify(nrqlConditionConfiguratorMock).sync(policyConfigurationMock);
    order.verify(syntheticsConditionConfiguratorMock).sync(policyConfigurationMock);
    order.verify(channelConfiguratorMock).sync(policyConfigurationMock);
    order.verifyNoMoreInteractions();
  }
}
origin: ocadotechnology/newrelic-alerts-configurator

@Test
public void shouldDeleteAndCreateNewPolicy_whenPolicyUpdated() {
  // given
  when(alertsPoliciesApiMock.getByName(POLICY_NAME)).thenReturn(Optional.of(ALERT_POLICY_DIFFERENT));
  AlertsPolicy expectedPolicy = AlertsPolicy.builder().name(POLICY_NAME).incidentPreference(INCIDENT_PREFERENCE.name()).build();
  // when
  testee.sync(CONFIGURATION);
  // then
  InOrder order = inOrder(alertsPoliciesApiMock);
  order.verify(alertsPoliciesApiMock).getByName(POLICY_NAME);
  order.verify(alertsPoliciesApiMock).delete(ALERT_POLICY_DIFFERENT.getId());
  order.verify(alertsPoliciesApiMock).create(expectedPolicy);
  order.verifyNoMoreInteractions();
}
com.ocadotechnology.newrelic.alertsconfiguratorPolicyConfiguratorsync

Popular methods of PolicyConfigurator

  • <init>

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • getContentResolver (Context)
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now