示例#1
0
 public static Message updateConcludesPendingUpdate(final RpslObject rpslObject) {
   return new Message(
       Type.INFO,
       "This update concludes a pending update on %s %s",
       rpslObject.getType().getName(),
       rpslObject.getKey());
 }
示例#2
0
 // NOTE: this errormessage is being used by webupdates.
 public static Message objectInUse(final RpslObject object) {
   return new Message(
       Type.ERROR,
       "Object [%s] %s is referenced from other objects",
       object.getType().getName().toLowerCase(),
       object.getKey());
 }
示例#3
0
 public static Message updatePendingAuthenticationSaved(final RpslObject rpslObject) {
   return new Message(
       Type.INFO,
       "The %s object %s will be saved for one week pending the second authorisation",
       rpslObject.getType().getName(),
       rpslObject.getKey());
 }
示例#4
0
  // NOTE: this errormessage is being used by webupdates.
  public static Message parentAuthenticationFailed(
      final RpslObject object,
      final AttributeType attributeType,
      final Iterable<RpslObject> candidates) {
    final CharSequence joined =
        LIST_JOINED.join(
            Iterables.transform(
                candidates,
                new Function<RpslObject, CharSequence>() {
                  @Override
                  public CharSequence apply(final RpslObject input) {
                    return input == null ? "" : input.getKey();
                  }
                }));

    return new Message(
        Type.ERROR,
        ""
            + "Authorisation for parent [%s] %s failed\n"
            + "using \"%s:\"\n"
            + (joined.length() == 0 ? "no valid maintainer found\n" : "not authenticated by: %s"),
        object.getType().getName(),
        object.getKey(),
        attributeType.getName(),
        joined);
  }
  @Test(expected = IllegalArgumentException.class)
  public void add_to_index_empty_ifaddr() {
    RpslObject rpslObject = RpslObject.parse("inet-rtr: test\nifaddr:\n");
    RpslObjectInfo rpslObjectInfo = new RpslObjectInfo(1, ObjectType.INET_RTR, rpslObject.getKey());

    subject.addToIndex(
        whoisTemplate, rpslObjectInfo, rpslObject, getIfAddrAttributeAsString(rpslObject));
  }
  @Test
  public void lookup_passes_x_forwarded_for() {
    restClient
        .request()
        .addHeader(HttpHeaders.X_FORWARDED_FOR, "10.20.30.40")
        .lookup(ObjectType.MNTNER, OWNER_MNT.getKey().toString());

    assertThat(queryLog.getMessages(), hasSize(1));
    assertThat(queryLog.getMessage(0), containsString(" PW-API-INFO <0+1+0> "));
    assertThat(queryLog.getMessage(0), containsString("ms [10.20.30.40] -- "));
  }
  @Test
  public void remove_from_index() {
    RpslObject rpslObject = RpslObject.parse("inet-rtr: test\nifaddr: 10.2.3.4 masklen 32");
    checkRows(0);
    addObject(rpslObject);
    checkRows(1);

    subject.removeFromIndex(
        whoisTemplate,
        new RpslObjectInfo(getObjectId(rpslObject), ObjectType.INET_RTR, rpslObject.getKey()));

    checkRows(0);
  }
  @Test
  public void add_to_index() {
    RpslObject rpslObject = RpslObject.parse("inet-rtr: test\nifaddr: 10.2.3.4 masklen 32");
    RpslObjectInfo rpslObjectInfo = new RpslObjectInfo(1, ObjectType.INET_RTR, rpslObject.getKey());
    checkRows(0);

    final int rows =
        subject.addToIndex(
            whoisTemplate, rpslObjectInfo, rpslObject, getIfAddrAttributeAsString(rpslObject));

    assertThat(rows, is(1));
    checkRows(1);
  }
示例#9
0
  public Collection<RpslObjectInfo> getReferencedIrtsInHierarchy(final RpslObject rpslObject) {
    final Collection<RpslObjectInfo> irts = getReferencedIrts(rpslObject);
    if (!irts.isEmpty()) {
      return irts;
    }

    final K resource = createResource(rpslObject.getKey());
    final List<V> entries = ipTree.findAllLessSpecific(resource);
    for (final V entry : entries) {
      final RpslObject object = rpslObjectDao.getById(entry.getObjectId());
      final Collection<RpslObjectInfo> referencedIrts = getReferencedIrts(object);
      if (!referencedIrts.isEmpty()) {
        return referencedIrts;
      }
    }

    return Collections.emptyList();
  }
示例#10
0
 public boolean isMaintainedInRirSpace(final RpslObject rpslObject) {
   return isMaintainedInRirSpace(rpslObject.getType(), rpslObject.getKey());
 }