Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 3
0
  public void logUpdate(final Update update) {
    Element updateElement = createOrGetUpdateElement(update);

    int attempt = 1;
    try {
      attempt = Integer.parseInt(updateElement.getAttribute("attempt")) + 1;
      updates.removeChild(updateElement);
      updateElements.remove(update);

      updateElement = createOrGetUpdateElement(update);
    } catch (NumberFormatException ignored) {
    }

    updateElement.setAttribute("attempt", String.valueOf(attempt));
    updateElement.setAttribute(
        "time", FormatHelper.dateTimeToString(dateTimeProvider.getCurrentDateTime()));

    final RpslObject updatedObject = update.getSubmittedObject();
    updateElement.appendChild(keyValue("key", updatedObject.getFormattedKey()));
    updateElement.appendChild(keyValue("operation", update.getOperation().name()));
    updateElement.appendChild(
        keyValue("reason", StringUtils.join(update.getDeleteReasons(), ", ")));
    updateElement.appendChild(keyValue("paragraph", update.getParagraph().getContent()));
    updateElement.appendChild(keyValue("object", updatedObject.toString()));
  }
Ejemplo n.º 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);
  }
Ejemplo n.º 5
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());
 }
  @Test
  public void all_organisations_returned() {
    databaseHelper.addObject(
        "mntner: TEST-MNT\nmnt-by:TEST-MNT\nauth: SSO [email protected]\nsource:test");
    final RpslObject org1 =
        RpslObject.parse(
            "" + "organisation: ORG-TST1-TEST\n" + "mnt-by: TEST-MNT\n" + "source: TEST");
    databaseHelper.addObject(org1);
    final RpslObject org2 =
        RpslObject.parse(
            "" + "organisation: ORG-MD5-TEST\n" + "mnt-by: TEST-MNT\n" + "source: TEST");
    databaseHelper.addObject(org2);

    final WhoisResources result =
        RestTest.target(
                getPort(),
                "api/user/ed7cd420-6402-11e3-949a-0800200c9a66/organisations",
                null,
                apiKey)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .get(WhoisResources.class);

    final List<WhoisObject> whoisObjects = result.getWhoisObjects();
    assertThat(whoisObjects, hasSize(2));

    assertThat(
        whoisObjectMapper.map(whoisObjects.get(0), FormattedClientAttributeMapper.class), is(org2));
    assertThat(
        whoisObjectMapper.map(whoisObjects.get(1), FormattedClientAttributeMapper.class), is(org1));
  }
Ejemplo n.º 7
0
  private Set<Integer> loadObjects(
      final List<Identifiable> proxy, final Map<Integer, RpslObject> loadedObjects) {
    final StringBuilder queryBuilder = new StringBuilder();
    final List<Integer> objectIds = Lists.newArrayListWithExpectedSize(proxy.size());
    for (final Identifiable identifiable : proxy) {
      final Integer objectId = identifiable.getObjectId();
      if (loadedObjects.containsKey(objectId)) {
        continue;
      }

      if (identifiable instanceof RpslObject) {
        loadedObjects.put(objectId, (RpslObject) identifiable);
      } else {
        if (queryBuilder.length() > 0) {
          // UNION ALL is much faster than IN
          queryBuilder.append(" UNION ALL ");
        }

        queryBuilder.append(
            ""
                + "SELECT object_id, object "
                + "FROM last "
                + "WHERE object_id = ? "
                + "AND sequence_id != 0");

        objectIds.add(objectId);
      }
    }

    final List<RpslObject> rpslObjects =
        jdbcTemplate.query(
            queryBuilder.toString(),
            new PreparedStatementSetter() {
              @Override
              public void setValues(final PreparedStatement ps) throws SQLException {
                for (int i = 0; i < objectIds.size(); i++) {
                  ps.setInt(i + 1, objectIds.get(i));
                }
              }
            },
            new RpslObjectRowMapper());

    for (final RpslObject rpslObject : rpslObjects) {
      loadedObjects.put(rpslObject.getObjectId(), rpslObject);
    }

    if (proxy.size() == loadedObjects.size()) {
      return Collections.emptySet();
    }

    final Set<Integer> differences = Sets.newLinkedHashSet();
    for (final Identifiable identifiable : proxy) {
      final Integer objectId = identifiable.getObjectId();
      if (!loadedObjects.containsKey(objectId)) {
        differences.add(objectId);
      }
    }

    return differences;
  }
Ejemplo n.º 8
0
  @Test
  public void isMaintainedInRirSpace_ipv6() {
    final AuthoritativeResource resourceData =
        AuthoritativeResource.loadFromScanner(
            logger,
            "RIPE-GRS",
            new Scanner(
                ""
                    + "ripencc|DE|ipv6|2001:608::|32|19990812|allocated\n"
                    + "ripencc|NL|ipv6|2001:610::|32|19990819|allocated\n"));

    assertThat(resourceData.isEmpty(), is(false));

    assertThat(
        resourceData.isMaintainedInRirSpace(RpslObject.parse("inet6num: 2001::")), is(false));
    assertThat(
        resourceData.isMaintainedInRirSpace(ObjectType.INET6NUM, ciString("2001::")), is(false));
    assertThat(
        resourceData.isMaintainedInRirSpace(RpslObject.parse("inet6num: 2002:608::")), is(false));
    assertThat(
        resourceData.isMaintainedInRirSpace(ObjectType.INET6NUM, ciString("2002:608::")),
        is(false));
    assertThat(
        resourceData.isMaintainedInRirSpace(RpslObject.parse("inet6num: 2001:608::")), is(true));
    assertThat(
        resourceData.isMaintainedInRirSpace(ObjectType.INET6NUM, ciString("2001:608::/32")),
        is(true));
    assertThat(
        resourceData.isMaintainedInRirSpace(RpslObject.parse("inet6num: 2001:608:abcd::")),
        is(true));
    assertThat(
        resourceData.isMaintainedInRirSpace(ObjectType.INET6NUM, ciString("2001:608:abcd::")),
        is(true));
  }
Ejemplo n.º 9
0
  public static RpslObject translateAuth(
      final RpslObject rpslObject, final AuthTranslator authTranslator) {
    if (!rpslObject.containsAttribute(AttributeType.AUTH)) { // IRT also has auth:
      return rpslObject;
    }

    final Map<RpslAttribute, RpslAttribute> replace = Maps.newHashMap();
    for (RpslAttribute authAttribute : rpslObject.findAttributes(AttributeType.AUTH)) {
      final Iterator<String> authIterator =
          SPACE_SPLITTER.split(authAttribute.getCleanValue()).iterator();
      final String authType = authIterator.next().toUpperCase();
      if (authIterator.hasNext()) {
        final String authToken = authIterator.next();
        final RpslAttribute result = authTranslator.translate(authType, authToken, authAttribute);
        if (result != null) {
          replace.put(authAttribute, result);
        }
      }
    }

    if (replace.isEmpty()) {
      return rpslObject;
    } else {
      return new RpslObjectBuilder(rpslObject).replaceAttributes(replace).get();
    }
  }
Ejemplo n.º 10
0
  @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));
  }
Ejemplo n.º 11
0
 @Test
 public void isMaintainedInRirSpace_invalid_resource() {
   final AuthoritativeResource resourceData =
       AuthoritativeResource.loadFromScanner(logger, "RIPE-GRS", new Scanner(""));
   assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: 12345")), is(false));
   assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("inetnum: 0")), is(false));
   assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("inet6num: 0")), is(false));
   assertThat(resourceData.isEmpty(), is(true));
 }
Ejemplo n.º 12
0
 @Test
 public void isMaintainedInRirSpace_empty_file() {
   final AuthoritativeResource resourceData =
       AuthoritativeResource.loadFromScanner(logger, "RIPE-GRS", new Scanner(""));
   assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS123")), is(false));
   assertThat(
       resourceData.isMaintainedInRirSpace(RpslObject.parse("inetnum: 10.0.0.0 - 10.255.255.255")),
       is(false));
   assertThat(
       resourceData.isMaintainedInRirSpace(RpslObject.parse("inet6num: 2001::/20")), is(false));
   assertThat(resourceData.isEmpty(), is(true));
 }
Ejemplo n.º 13
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);
  }
Ejemplo n.º 14
0
  @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);
  }
Ejemplo n.º 15
0
  @Test
  public void isMaintainedInRirSpace_aut_num() {
    final AuthoritativeResource resourceData =
        AuthoritativeResource.loadFromScanner(
            logger,
            "RIPE-GRS",
            new Scanner(
                ""
                    + "ripencc|EU|asn|7|1|19930901|allocated\n"
                    + "ripencc|EU|asn|28|10|19930901|allocated\n"));

    assertThat(resourceData.isEmpty(), is(false));

    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS6")), is(false));
    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS6")), is(false));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS7")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS7")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS8")), is(false));
    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS8")), is(false));

    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS27")), is(false));
    assertThat(
        resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS27")), is(false));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS28")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS28")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS29")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS29")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS37")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS37")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS38")), is(false));
    assertThat(
        resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS38")), is(false));
  }
  @Test
  public void only_organisations_returned() {
    databaseHelper.addObject("mntner: TEST-MNT\nmnt-by:TEST-MNT\nauth: SSO [email protected]");
    final RpslObject organisation =
        RpslObject.parse(
            ""
                + "organisation: ORG-TST-TEST\n"
                + "mnt-ref: TEST-MNT\n"
                + "mnt-by: TEST-MNT\n"
                + "source: TEST");
    databaseHelper.addObject(organisation);
    databaseHelper.addObject("person: Test Person\nnic-hdl: TST-TEST\nmnt-by: TEST-MNT");

    final WhoisResources result =
        RestTest.target(
                getPort(),
                "api/user/8ffe29be-89ef-41c8-ba7f-0e1553a623e5/organisations",
                null,
                apiKey)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .get(WhoisResources.class);

    final List<WhoisObject> whoisObjects = result.getWhoisObjects();
    assertThat(whoisObjects, hasSize(1));

    final RpslObject resultOrg =
        whoisObjectMapper.map(whoisObjects.get(0), FormattedClientAttributeMapper.class);

    assertThat(resultOrg, is(organisation));
  }
Ejemplo n.º 17
0
  @Test
  public void load_country_ignored() {
    final AuthoritativeResource resourceData =
        AuthoritativeResource.loadFromScanner(
            logger,
            "RIPE-GRS",
            new Scanner(
                ""
                    + "ripencc|*|asn|7|1|19930901|allocated\n"
                    + "ripencc|EU|asn|28|1|19930901|allocated\n"));

    assertThat(resourceData.getNrAutNums(), is(1));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS7")), is(false));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS28")), is(true));
    assertThat(resourceData.isEmpty(), is(false));
  }
  @Test
  public void organisation_only_added_once() {
    databaseHelper.addObject("mntner: TEST-MNT\nmnt-by:TEST-MNT\nauth: SSO [email protected]");
    final RpslObject organisation =
        RpslObject.parse(
            ""
                + "organisation: ORG-TST-TEST\n"
                + "mnt-by: TEST-MNT\n"
                + "mnt-by: TEST-MNT\n"
                + "source: TEST");
    databaseHelper.addObject(organisation);

    final WhoisResources result =
        RestTest.target(
                getPort(),
                "api/user/906635c2-0405-429a-800b-0602bd716124/organisations",
                null,
                apiKey)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .get(WhoisResources.class);

    final List<WhoisObject> whoisObjects = result.getWhoisObjects();
    assertThat(whoisObjects, hasSize(1));

    final RpslObject resultOrg =
        whoisObjectMapper.map(whoisObjects.get(0), FormattedClientAttributeMapper.class);

    assertThat(resultOrg, is(organisation));
  }
  @Test
  public void organisations_w_mnt_by_and_ref_RS_found_via_mnt_ref() {
    databaseHelper.addObject("mntner: TEST-MNT\nmnt-by:TEST-MNT\nauth: SSO [email protected]");
    databaseHelper.addObject(
        "mntner: RIPE-NCC-HM-MNT\nmnt-by:RIPE-NCC-HM-MNT\nauth: SSO [email protected]");
    final RpslObject organisation =
        RpslObject.parse(
            ""
                + "organisation: ORG-TST-TEST\n"
                + "mnt-ref: TEST-MNT\n"
                + "mnt-ref: RIPE-NCC-HM-MNT\n"
                + "mnt-by: RIPE-NCC-HM-MNT\n"
                + "source: TEST");
    databaseHelper.addObject(organisation);

    final WhoisResources result =
        RestTest.target(
                getPort(),
                "api/user/ed7cd420-6402-11e3-949a-0800200c9a66/organisations",
                null,
                apiKey)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .get(WhoisResources.class);

    final RpslObject resultOrg =
        whoisObjectMapper.map(
            result.getWhoisObjects().get(0), FormattedClientAttributeMapper.class);

    assertThat(resultOrg, is(organisation));
  }
Ejemplo n.º 20
0
 private int addObject(final RpslObject rpslObject) {
   databaseHelper.addObject(
       "inet-rtr: " + rpslObject.findAttribute(AttributeType.INET_RTR).getValue());
   final int objectId = getObjectId(rpslObject);
   final long ifAddr = Ipv4Resource.parse(getIfAddrAttributeAsString(rpslObject)).begin();
   whoisTemplate.update("INSERT INTO ifaddr (object_id, ifaddr) VALUES (?, ?)", objectId, ifAddr);
   return objectId;
 }
Ejemplo n.º 21
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 validate_enum() {
    when(update.getUpdatedObject())
        .thenReturn(RpslObject.parse("" + "domain: 2.1.2.1.5.5.5.2.0.2.1.e164.arpa"));

    subject.validate(update, updateContext);

    verifyZeroInteractions(ipv4DomainTree, ipv6DomainTree);
  }
Ejemplo n.º 23
0
 @Test
 public void isMaintainedInRirSpace_unknown_data() {
   final AuthoritativeResource resourceData = AuthoritativeResource.unknown();
   assertThat(resourceData.isEmpty(), is(true));
   assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("aut-num: AS6")), is(false));
   assertThat(resourceData.isMaintainedInRirSpace(ObjectType.AUT_NUM, ciString("AS6")), is(false));
   assertThat(
       resourceData.isMaintainedInRirSpace(RpslObject.parse("inetnum: 1.0.0.0 - 1.255.255.255")),
       is(false));
   assertThat(
       resourceData.isMaintainedInRirSpace(
           ObjectType.INETNUM, ciString("1.0.0.0 - 1.255.255.255")),
       is(false));
   assertThat(
       resourceData.isMaintainedInRirSpace(RpslObject.parse("inet6num: 2001::")), is(false));
   assertThat(
       resourceData.isMaintainedInRirSpace(ObjectType.INET6NUM, ciString("2001::")), is(false));
 }
  @Before
  public void setup() throws Exception {
    final RpslObject rootMntner =
        RpslObject.parse(
            ""
                + "mntner:  RIPE-NCC-HM-MNT\n"
                + "descr:   description\n"
                + "admin-c: TEST-RIPE\n"
                + "mnt-by:  RIPE-NCC-HM-MNT\n"
                + "referral-by: RIPE-NCC-HM-MNT\n"
                + "upd-to:  [email protected]\n"
                + "auth:    MD5-PW $1$/7f2XnzQ$p5ddbI7SXq4z4yNrObFS/0 # emptypassword"
                + "changed: [email protected] 20120707\n"
                + "source:  TEST");

    final RpslObject adminPerson =
        RpslObject.parse(
            ""
                + "person:  Admin Person\n"
                + "address: Admin Road\n"
                + "address: Town\n"
                + "address: UK\n"
                + "phone:   +44 282 411141\n"
                + "nic-hdl: TEST-RIPE\n"
                + "mnt-by:  TST-MNT\n"
                + "changed: [email protected] 20120101\n"
                + "source:  TEST");

    final RpslObject normalMntner =
        RpslObject.parse(
            ""
                + "mntner:  TST-MNT\n"
                + "descr:   description\n"
                + "admin-c: TEST-RIPE\n"
                + "mnt-by:  TST-MNT\n"
                + "referral-by: TST-MNT\n"
                + "upd-to:  [email protected]\n"
                + "auth:    MD5-PW $1$fU9ZMQN9$QQtm3kRqZXWAuLpeOiLN7. # update\n"
                + "changed: [email protected] 20120707\n"
                + "source:  TEST");

    databaseHelper.addObjects(Lists.newArrayList(rootMntner, adminPerson, normalMntner));
  }
  @Test
  public void validate_not_referenced() {
    final RpslObject object = RpslObject.parse("mntner: TST-MNT");
    when(update.getReferenceObject()).thenReturn(object);
    when(rpslObjectUpdateDao.getInvalidReferences(object))
        .thenReturn(Collections.<RpslAttribute, Set<String>>emptyMap());
    subject.validate(update, updateContext);

    verifyZeroInteractions(updateContext);
  }
Ejemplo n.º 26
0
  @Test
  public void addToIndex() throws Exception {
    IndexWithReference subject =
        new IndexWithReference(AttributeType.MNT_LOWER, "mnt_lower", "mnt_id");
    final RpslObject rpslObject = RpslObject.parse("mntner: RIPE-MNT\nmnt-by:RIPE-MNT");
    rpslObjectUpdateDao.createObject(rpslObject);
    final RpslObjectInfo maintainer = new RpslObjectInfo(1, ObjectType.MNTNER, "MNTNER");

    final int added = subject.addToIndex(whoisTemplate, maintainer, null, "RIPE-MNT");
    assertThat(added, is(1));
  }
Ejemplo n.º 27
0
  @Test
  public void findInIndex_not_found() throws Exception {
    IndexWithReference subject = new IndexWithReference(AttributeType.MNT_REF, "mnt_ref", "mnt_id");
    final RpslObject maintainer = RpslObject.parse("mntner:MNT-TEST\nmnt-by:MNT-TEST");
    final RpslObjectUpdateInfo objectInfo = rpslObjectUpdateDao.createObject(maintainer);

    assertThat(subject.findInIndex(whoisTemplate, objectInfo.getKey()).size(), is(0));
    assertThat(subject.findInIndex(whoisTemplate, objectInfo).size(), is(0));
    assertThat(
        subject.findInIndex(whoisTemplate, objectInfo, ObjectType.ORGANISATION).size(), is(0));
  }
Ejemplo n.º 28
0
  @Test
  public void isMaintainedInRirSpace_no_resource() {
    final AuthoritativeResource resourceData =
        AuthoritativeResource.loadFromScanner(logger, "RIPE-GRS", new Scanner(""));
    assertThat(resourceData.isMaintainedInRirSpace(RpslObject.parse("mntner: DEV-MNT")), is(true));
    assertThat(
        resourceData.isMaintainedInRirSpace(
            RpslObject.parse("person: Test Person\nnic-hdl: TP1-TEST")),
        is(true));
    assertThat(
        resourceData.isMaintainedInRirSpace(RpslObject.parse("organisation: ORG-TOL1-TEST")),
        is(true));

    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.MNTNER, ciString("12345")), is(true));
    assertThat(resourceData.isMaintainedInRirSpace(ObjectType.PERSON, ciString("0")), is(true));
    assertThat(
        resourceData.isMaintainedInRirSpace(ObjectType.ORGANISATION, ciString("0")), is(true));

    assertThat(resourceData.isEmpty(), is(true));
  }
Ejemplo n.º 29
0
  @Before
  public void startupWhoisServer() throws Exception {
    databaseHelper.addObject(RpslObject.parse("mntner:RIPE-NCC-MNT\nnic-hdl:AP111-RIPE"));
    databaseHelper.addObject(
        RpslObject.parse(
            ""
                + "role:         Asia Pacific Network Information Centre\n"
                + "address:      APNIC, see http://www.apnic.net\n"
                + "e-mail:       [email protected]\n"
                + "admin-c:      APNC1-RIPE\n"
                + "tech-c:       APNC1-RIPE\n"
                + "nic-hdl:      APNC1-RIPE\n"
                + "remarks:      For more information on APNIC assigned blocks, connect\n"
                + "remarks:      to APNIC's whois database, whois.apnic.net.\n"
                + "mnt-by:       RIPE-NCC-MNT\n"
                + "changed:      [email protected] 20010411\n"
                + "source:       RIPE"));

    queryServer.start();
  }
Ejemplo n.º 30
0
  @Test
  public void remove_from_index_different_inetrtr() {
    RpslObject rpslObject = RpslObject.parse("inet-rtr: test\nifaddr: 10.2.3.4 masklen 32");
    addObject(rpslObject);
    checkRows(1);

    subject.removeFromIndex(
        whoisTemplate, new RpslObjectInfo(2, ObjectType.INET_RTR, "another inet-rtr"));

    checkRows(1);
  }