@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")); }
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); }
@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; }
public boolean isValidValue(final ObjectType objectType, final CIString value) { return isValidValue(objectType, value.toString()); }
@Override @Nullable public RpslObjectInfo findByKeyOrNull(final ObjectType type, final CIString searchKey) { return findByKeyOrNull(type, searchKey.toString()); }
@Override @Nullable public RpslObject getByKeyOrNull(final ObjectType type, final CIString key) { return getByKeyOrNull(type, key.toString()); }
@Override public RpslObject getByKey(final ObjectType type, final CIString key) { return getByKey(type, key.toString()); }
final K createResource(CIString key) { return createResource(key.toString()); }