Ejemplo n.º 1
0
  @Test(groups = "slow")
  public void testAddAndRemoveTagsForBundle() throws Exception {
    final String name = UUID.randomUUID().toString().substring(0, 20);
    final CallContext callContext =
        callContextFactory.createCallContext(
            UUID.randomUUID().toString(), CallOrigin.TEST, UserType.TEST);
    final String externalKey = UUID.randomUUID().toString();

    final Account accountData = new MockAccountBuilder().currency(Currency.MXN).build();
    final Account account = accountUserApi.createAccount(accountData, callContext);
    final SubscriptionBundle bundle =
        entitlementUserApi.createBundleForAccount(account.getId(), externalKey, callContext);
    final UUID bundleId = bundle.getId();

    Assert.assertEquals(
        subscriptionTransitionTagSqlDao
            .getTagsForBusinessSubscriptionTransitionByKey(externalKey)
            .size(),
        0);
    tagRecorder.tagAdded(ObjectType.BUNDLE, bundleId, name);
    Assert.assertEquals(
        subscriptionTransitionTagSqlDao
            .getTagsForBusinessSubscriptionTransitionByKey(externalKey)
            .size(),
        1);
    tagRecorder.tagRemoved(ObjectType.BUNDLE, bundleId, name);
    Assert.assertEquals(
        subscriptionTransitionTagSqlDao
            .getTagsForBusinessSubscriptionTransitionByKey(externalKey)
            .size(),
        0);
  }
Ejemplo n.º 2
0
  @Test(groups = "slow")
  public void testAddAndRemoveTagsForAccount() throws Exception {
    final String name = UUID.randomUUID().toString().substring(0, 20);
    final CallContext callContext =
        callContextFactory.createCallContext(
            UUID.randomUUID().toString(), CallOrigin.TEST, UserType.TEST);
    final String accountKey = UUID.randomUUID().toString();

    final Account accountData =
        new MockAccountBuilder().externalKey(accountKey).currency(Currency.MXN).build();
    final Account account = accountUserApi.createAccount(accountData, callContext);
    final UUID accountId = account.getId();

    Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 0);
    tagRecorder.tagAdded(ObjectType.ACCOUNT, accountId, name);
    Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 1);
    tagRecorder.tagRemoved(ObjectType.ACCOUNT, accountId, name);
    Assert.assertEquals(accountTagSqlDao.getTagsForAccountByKey(accountKey).size(), 0);
  }