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

How to use
DefaultOverdueStateSet
in
com.ning.billing.overdue.config

Best Java code snippets using com.ning.billing.overdue.config.DefaultOverdueStateSet (Showing top 9 results out of 315)

origin: com.ning.billing/killbill-overdue

@Override
public DefaultOverdueState calculateOverdueState(final BillingState billingState, final LocalDate now) throws OverdueApiException {
  for (final DefaultOverdueState overdueState : getStates()) {
    if (overdueState.getCondition() != null && overdueState.getCondition().evaluate(billingState, now)) {
      return overdueState;
    }
  }
  return getClearState();
}
origin: com.ning.billing/killbill-overdue

final InputStream is = new ByteArrayInputStream(xml.getBytes());
final OverdueConfig c = XMLLoader.getObjectFromStreamNoValidation(is, OverdueConfig.class);
Assert.assertEquals(c.getStateSet().size(), 2);
Assert.assertNull(c.getStateSet().getStates()[0].getEnterStateEmailNotification());
Assert.assertNotNull(c.getStateSet().getInitialReevaluationInterval());
Assert.assertEquals(c.getStateSet().getInitialReevaluationInterval().getDays(), 1);
final EmailNotification secondNotification = c.getStateSet().getStates()[1].getEnterStateEmailNotification();
Assert.assertEquals(secondNotification.getSubject(), "ToTo");
Assert.assertEquals(secondNotification.getTemplateName(), "Titi");
origin: com.ning.billing/killbill-overdue

@Override
public int size() {
  return getStates().length;
}
origin: com.ning.billing/killbill-overdue

@Test(groups = "slow")
public void testApplicator() throws Exception {
  final InputStream is = new ByteArrayInputStream(testOverdueHelper.getConfigXml().getBytes());
  final OverdueConfig config = XMLLoader.getObjectFromStreamNoValidation(is, OverdueConfig.class);
  overdueWrapperFactory.setOverdueConfig(config);
  final Account account = Mockito.mock(Account.class);
  Mockito.when(account.getId()).thenReturn(UUID.randomUUID());
  final OverdueStateSet overdueStateSet = config.getStateSet();
  final OverdueState clearState = config.getStateSet().findState(DefaultBlockingState.CLEAR_STATE_NAME);
  OverdueState state;
  state = config.getStateSet().findState("OD1");
  applicator.apply(overdueStateSet, null, account, clearState, state, internalCallContext);
  testOverdueHelper.checkStateApplied(state);
  checkBussEvent("OD1");
  state = config.getStateSet().findState("OD2");
  applicator.apply(overdueStateSet, null, account, clearState, state, internalCallContext);
  testOverdueHelper.checkStateApplied(state);
  checkBussEvent("OD2");
  state = config.getStateSet().findState("OD3");
  applicator.apply(overdueStateSet, null, account, clearState, state, internalCallContext);
  testOverdueHelper.checkStateApplied(state);
  checkBussEvent("OD3");
}
origin: com.ning.billing/killbill-overdue

  @Override
  public OverdueState getFirstState() {
    return getStates()[0];
  }
}
origin: com.ning.billing/killbill-overdue

  @Test(groups = "slow")
  public void testWrapperNoConfig() throws Exception {
    overdueWrapperFactory.setOverdueConfig(null);

    final Account account;
    final OverdueWrapper wrapper;
    final OverdueState state;

    final InputStream is = new ByteArrayInputStream(testOverdueHelper.getConfigXml().getBytes());
    final OverdueConfig config = XMLLoader.getObjectFromStreamNoValidation(is, OverdueConfig.class);
    state = config.getStateSet().findState(DefaultBlockingState.CLEAR_STATE_NAME);
    account = testOverdueHelper.createAccount(clock.getUTCToday().minusDays(31));
    wrapper = overdueWrapperFactory.createOverdueWrapperFor(account);
    final OverdueState result = wrapper.refresh(internalCallContext);

    Assert.assertEquals(result.getName(), state.getName());
    Assert.assertEquals(result.blockChanges(), state.blockChanges());
    Assert.assertEquals(result.disableEntitlementAndChangesBlocked(), state.disableEntitlementAndChangesBlocked());
  }
}
origin: com.ning.billing/killbill-overdue

@Override
public ValidationErrors validate(final OverdueConfig root,
                 final ValidationErrors errors) {
  for (final DefaultOverdueState state : getStates()) {
    state.validate(root, errors);
  }
  try {
    getClearState();
  } catch (OverdueApiException e) {
    if (e.getCode() == ErrorCode.CAT_MISSING_CLEAR_STATE.getCode()) {
      errors.add("Overdue state set is missing a clear state.",
            root.getURI(), this.getClass(), "");
    }
  }
  return errors;
}
origin: com.ning.billing/killbill-overdue

@Override
public OverdueState findState(final String stateName) throws OverdueApiException {
  if (stateName.equals(DefaultBlockingState.CLEAR_STATE_NAME)) {
    return clearState;
  }
  for (final DefaultOverdueState state : getStates()) {
    if (state.getName().equals(stateName)) {
      return state;
    }
  }
  throw new OverdueApiException(ErrorCode.CAT_NO_SUCH_OVEDUE_STATE, stateName);
}
origin: com.ning.billing/killbill-overdue

@Test(groups = "slow")
public void testWrapperBasic() throws Exception {
  final InputStream is = new ByteArrayInputStream(testOverdueHelper.getConfigXml().getBytes());
  final OverdueConfig config = XMLLoader.getObjectFromStreamNoValidation(is, OverdueConfig.class);
  overdueWrapperFactory.setOverdueConfig(config);
  Account account;
  OverdueWrapper wrapper;
  OverdueState state;
  state = config.getStateSet().findState("OD1");
  account = testOverdueHelper.createAccount(clock.getUTCToday().minusDays(31));
  wrapper = overdueWrapperFactory.createOverdueWrapperFor(account);
  wrapper.refresh(internalCallContext);
  testOverdueHelper.checkStateApplied(state);
  state = config.getStateSet().findState("OD2");
  account = testOverdueHelper.createAccount(clock.getUTCToday().minusDays(41));
  wrapper = overdueWrapperFactory.createOverdueWrapperFor(account);
  wrapper.refresh(internalCallContext);
  testOverdueHelper.checkStateApplied(state);
  state = config.getStateSet().findState("OD3");
  account = testOverdueHelper.createAccount(clock.getUTCToday().minusDays(51));
  wrapper = overdueWrapperFactory.createOverdueWrapperFor(account);
  wrapper.refresh(internalCallContext);
  testOverdueHelper.checkStateApplied(state);
}
com.ning.billing.overdue.configDefaultOverdueStateSet

Most used methods

  • getStates
  • findState
  • getClearState
  • getInitialReevaluationInterval
  • size

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JComboBox (javax.swing)
  • Top plugins for Android Studio
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