Ejemplo n.º 1
0
  @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"));
  }
Ejemplo n.º 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;
  }
Ejemplo n.º 3
0
  @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);
  }
Ejemplo n.º 4
0
  public Set<ObjectType> getReferences(final CIString value) {
    if (this == AUTH && value.startsWith(ciString("MD5-PW"))) {
      return Collections.emptySet();
    }

    return attributeTypeBuilder.getReferences();
  }
Ejemplo n.º 5
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;
  }
Ejemplo n.º 6
0
 public boolean isValidValue(final ObjectType objectType, final CIString value) {
   return isValidValue(objectType, value.toString());
 }
Ejemplo n.º 7
0
 @Override
 @Nullable
 public RpslObjectInfo findByKeyOrNull(final ObjectType type, final CIString searchKey) {
   return findByKeyOrNull(type, searchKey.toString());
 }
Ejemplo n.º 8
0
 @Override
 @Nullable
 public RpslObject getByKeyOrNull(final ObjectType type, final CIString key) {
   return getByKeyOrNull(type, key.toString());
 }
Ejemplo n.º 9
0
 @Override
 public RpslObject getByKey(final ObjectType type, final CIString key) {
   return getByKey(type, key.toString());
 }
Ejemplo n.º 10
0
 final K createResource(CIString key) {
   return createResource(key.toString());
 }
Ejemplo n.º 11
0
 private boolean sourceMatchesContext(final String source) {
   return (source != null)
       && sourceContext.getCurrentSource().getName().equals(CIString.ciString(source));
 }