Exemplo n.º 1
0
  @Override
  public TagDefinition create(
      final String definitionName, final String description, final CallContext context)
      throws TagDefinitionApiException {
    final TagDefinition tag = new DefaultTagDefinition(definitionName, description, false);

    tags.put(tag.getId().toString(), tag);
    return tag;
  }
Exemplo n.º 2
0
  @Test(groups = "slow")
  public void testTags() throws EntityPersistenceException, TagApiException {
    final Account account = createTestAccount(1);
    final TagDefinition definition =
        new DefaultTagDefinition("Test Tag", "For testing only", false);
    final TagDefinitionSqlDao tagDescriptionDao = dbi.onDemand(TagDefinitionSqlDao.class);
    tagDescriptionDao.create(definition, internalCallContext);

    final TagDao tagDao = new AuditedTagDao(dbi, tagEventBuilder, bus);
    tagDao.insertTag(account.getId(), ObjectType.ACCOUNT, definition.getId(), internalCallContext);

    final Map<String, Tag> tagMap =
        tagDao.loadEntities(account.getId(), ObjectType.ACCOUNT, internalCallContext);
    assertEquals(tagMap.size(), 1);

    assertEquals(tagMap.values().iterator().next().getTagDefinitionId(), definition.getId());
  }