@Test
  public void transform_keys_domain_with_trailing_dot() {
    final RpslObject rpslObject = RpslObject.parse("domain:          17.45.212.in-addr.arpa.");

    final CIString result = attributeSanitizer.sanitizeKey(rpslObject);
    assertThat(result.toString(), is("17.45.212.in-addr.arpa"));
  }
示例#2
0
  private Collection<RpslObjectInfo> getReferencedIrts(final RpslObject object) {
    final List<RpslObjectInfo> result = Lists.newArrayList();
    for (final CIString irt : object.getValuesForAttribute(AttributeType.MNT_IRT)) {
      result.add(rpslObjectDao.findByKey(ObjectType.IRT, irt.toString()));
    }

    return result;
  }
  @Test
  public void transform_key_inetrtr_with_trailing_dot() {
    final RpslObject rpslObject =
        RpslObject.parse(
            "" + "inet-rtr:          test.ripe.net.\n" + "alias:          alias.ripe.net");

    final CIString result = attributeSanitizer.sanitizeKey(rpslObject);
    assertThat(result.toString(), is("test.ripe.net"));

    verifyNoMoreInteractions(objectMessages);
  }
示例#4
0
  @Override
  public Collection<RpslObjectInfo> relatedTo(
      final RpslObject identifiable, final Set<ObjectType> excludeObjectTypes) {
    final LinkedHashSet<RpslObjectInfo> result = Sets.newLinkedHashSet();

    for (final RpslAttribute attribute : identifiable.findAttributes(RELATED_TO_ATTRIBUTES)) {
      for (final CIString referenceValue : attribute.getReferenceValues()) {
        for (final ObjectType objectType : attribute.getType().getReferences(referenceValue)) {
          if (excludeObjectTypes.contains(objectType)) {
            continue;
          }

          for (RpslObjectInfo rpslObjectInfo :
              findByKeyInIndex(objectType, referenceValue.toString())) {
            if (rpslObjectInfo.getObjectId() != identifiable.getObjectId()) {
              result.add(rpslObjectInfo);
            }
          }
        }
      }
    }

    return result;
  }
示例#5
0
 public boolean isValidValue(final ObjectType objectType, final CIString value) {
   return isValidValue(objectType, value.toString());
 }
示例#6
0
 @Override
 @Nullable
 public RpslObjectInfo findByKeyOrNull(final ObjectType type, final CIString searchKey) {
   return findByKeyOrNull(type, searchKey.toString());
 }
示例#7
0
 @Override
 @Nullable
 public RpslObject getByKeyOrNull(final ObjectType type, final CIString key) {
   return getByKeyOrNull(type, key.toString());
 }
示例#8
0
 @Override
 public RpslObject getByKey(final ObjectType type, final CIString key) {
   return getByKey(type, key.toString());
 }
示例#9
0
 final K createResource(CIString key) {
   return createResource(key.toString());
 }