method2testcases
stringlengths
118
3.08k
### Question: PreparedUpdate implements UpdateContainer { public Credentials getCredentials() { return update.getCredentials(); } PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullable final RpslObject updatedObject, final Action action); PreparedUpdate(final Update update, @Nullable ...
### Question: PreparedUpdate implements UpdateContainer { public ObjectType getType() { return update.getType(); } PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullable final RpslObject updatedObject, final Action action); PreparedUpdate(final Update update, @Nullable final RpslObjec...
### Question: PreparedUpdate implements UpdateContainer { public String getKey() { return updatedObject.getKey().toString(); } PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullable final RpslObject updatedObject, final Action action); PreparedUpdate(final Update update, @Nullable fin...
### Question: ObjectKey { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final ObjectKey that = (ObjectKey) o; return Objects.equals(objectType, that.objectType) && Objects.equals(pkey, that.pkey); } ObjectKey(final ObjectType objectTyp...
### Question: ObjectKey { @Override public int hashCode() { return Objects.hash(objectType, pkey); } ObjectKey(final ObjectType objectType, final String pkey); ObjectKey(final ObjectType objectType, final CIString pkey); ObjectType getObjectType(); CIString getPkey(); @Override boolean equals(Object o); @Override int ...
### Question: ObjectKey { @Override public String toString() { return String.format("[%s] %s", objectType.getName(), pkey); } ObjectKey(final ObjectType objectType, final String pkey); ObjectKey(final ObjectType objectType, final CIString pkey); ObjectType getObjectType(); CIString getPkey(); @Override boolean equals(...
### Question: Notification { public String getEmail() { return email; } Notification(final String email); void add(final Type type, final PreparedUpdate update, UpdateContext updateContext); String getEmail(); Set<Update> getUpdates(final Type type); boolean has(final Type type); }### Answer: @Test public void getEmai...
### Question: Notification { public Set<Update> getUpdates(final Type type) { return updates.get(type); } Notification(final String email); void add(final Type type, final PreparedUpdate update, UpdateContext updateContext); String getEmail(); Set<Update> getUpdates(final Type type); boolean has(final Type type); }###...
### Question: Notification { public boolean has(final Type type) { return !updates.get(type).isEmpty(); } Notification(final String email); void add(final Type type, final PreparedUpdate update, UpdateContext updateContext); String getEmail(); Set<Update> getUpdates(final Type type); boolean has(final Type type); }###...
### Question: Credentials { public boolean has(final Class<? extends Credential> clazz) { return !ofType(clazz).isEmpty(); } Credentials(); Credentials(final Set<? extends Credential> credentials); Credentials add(final Collection<Credential> addedCredentials); Set<Credential> all(); T single(final Class<T> clazz); Se...
### Question: Update implements UpdateContainer { public boolean isSigned() { return paragraph.getCredentials().has(PgpCredential.class) || paragraph.getCredentials().has(X509Credential.class); } Update(final Paragraph paragraph, final Operation operation, @Nullable final List<String> deleteReasons, final RpslObject su...
### Question: Update implements UpdateContainer { public boolean isOverride() { return paragraph.getCredentials().has(OverrideCredential.class); } Update(final Paragraph paragraph, final Operation operation, @Nullable final List<String> deleteReasons, final RpslObject submittedObject); @Override Update getUpdate(); Par...
### Question: ProxyIterable implements Iterable<R> { @Override public Iterator<R> iterator() { return new Iterator<R>() { private final Iterator<P> sourceIterator = source.iterator(); private List<R> batch = initialBatch; private int idx; @Override public boolean hasNext() { return idx < batch.size() || sourceIterator....
### Question: NrtmConnectionPerIpLimitHandler extends SimpleChannelUpstreamHandler { private boolean connectionsExceeded(final InetAddress remoteAddresss) { final Integer count = connectionCounter.increment(remoteAddresss); return (count != null && count > maxConnectionsPerIp); } @Autowired NrtmConnectionPerIpLimitHan...
### Question: SocketChannelFactory { public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } private SocketChannelFactory(); static SocketChannel createSocketChannel(final String host, final int port); static Reader createReader(final SocketChannel socketChannel); sta...
### Question: SocketChannelFactory { public static Writer createWriter(final SocketChannel socketChannel) { return new Writer(socketChannel); } private SocketChannelFactory(); static SocketChannel createSocketChannel(final String host, final int port); static Reader createReader(final SocketChannel socketChannel); sta...
### Question: NrtmImporter implements EmbeddedValueResolverAware, ApplicationService { @PostConstruct void checkSources() { for (final CIString source : sources) { if (sourceContext.isVirtual(source)) { throw new IllegalArgumentException(String.format("Cannot use NRTM with virtual source: %s", source)); } JdbcRpslObjec...
### Question: NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void channelConnected(final ChannelHandlerContext ctx, final ChannelStateEvent e) throws Exception { PendingWrites.add(ctx.getChannel()); writeMessage(ctx.getChannel(), NrtmMessages.termsAndConditions()); super.channelConnected(ctx, ...
### Question: NrtmExceptionHandler extends SimpleChannelUpstreamHandler { @Override public void exceptionCaught(final ChannelHandlerContext ctx, final ExceptionEvent event) { final Channel channel = event.getChannel(); final Throwable exception = event.getCause(); if (!channel.isOpen()) { return; } if (exception instan...
### Question: CollectionHelper { public static <T> T uniqueResult(final Collection<T> c) { switch (c.size()) { case 0: return null; case 1: return c.iterator().next(); default: throw new IllegalStateException("Unexpected number of elements in collection: " + c.size()); } } private CollectionHelper(); static T uniqueRe...
### Question: IndexStrategyAdapter implements IndexStrategy { @Override public final AttributeType getAttributeType() { return attributeType; } IndexStrategyAdapter(final AttributeType attributeType); @Override final AttributeType getAttributeType(); @Override final int addToIndex(final JdbcTemplate jdbcTemplate, final...
### Question: IndexStrategyAdapter implements IndexStrategy { @Override public final int addToIndex(final JdbcTemplate jdbcTemplate, final RpslObjectInfo objectInfo, final RpslObject object, final CIString value) { return addToIndex(jdbcTemplate, objectInfo, object, value.toString()); } IndexStrategyAdapter(final Attri...
### Question: IndexStrategyAdapter implements IndexStrategy { @Override public final List<RpslObjectInfo> findInIndex(final JdbcTemplate jdbcTemplate, final CIString value) { return findInIndex(jdbcTemplate, value.toString()); } IndexStrategyAdapter(final AttributeType attributeType); @Override final AttributeType getA...
### Question: IndexStrategyAdapter implements IndexStrategy { @Override public void removeFromIndex(final JdbcTemplate jdbcTemplate, final RpslObjectInfo objectInfo) { } IndexStrategyAdapter(final AttributeType attributeType); @Override final AttributeType getAttributeType(); @Override final int addToIndex(final JdbcTe...
### Question: IndexStrategyAdapter implements IndexStrategy { @Override public String getLookupTableName() { return null; } IndexStrategyAdapter(final AttributeType attributeType); @Override final AttributeType getAttributeType(); @Override final int addToIndex(final JdbcTemplate jdbcTemplate, final RpslObjectInfo obje...
### Question: IndexStrategyAdapter implements IndexStrategy { @Override public String getLookupColumnName() { return null; } IndexStrategyAdapter(final AttributeType attributeType); @Override final AttributeType getAttributeType(); @Override final int addToIndex(final JdbcTemplate jdbcTemplate, final RpslObjectInfo obj...
### Question: IndexStrategies { public static IndexStrategy get(final AttributeType attributeType) { return INDEX_BY_ATTRIBUTE.get(attributeType); } private IndexStrategies(); static IndexStrategy get(final AttributeType attributeType); static List<IndexStrategy> getReferencing(final ObjectType objectType); }### Answ...
### Question: ObjectTypeIds { public static ObjectType getType(final int serialType) throws IllegalArgumentException { final ObjectType objectType = BY_TYPE_ID.get(serialType); if (objectType == null) { throw new IllegalArgumentException("Object type with objectTypeId " + serialType + " not found"); } return objectType...
### Question: SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } @Autowired SourceAwareDataSource(final BasicSourceContext sourceContext); @Override Connection getConnection(); @Override Connection getConn...
### Question: DateUtil { public static LocalDateTime fromDate(final Date date) { return Instant.ofEpochMilli(date.getTime()) .atZone(ZoneOffset.systemDefault()) .toLocalDateTime(); } private DateUtil(); static Date toDate(final LocalDateTime localDateTime); static Date toDate(final LocalDate localDate); static LocalDa...
### Question: DateUtil { public static Date toDate(final LocalDateTime localDateTime) { return Date.from(localDateTime.atZone(ZoneOffset.systemDefault()) .toInstant()); } private DateUtil(); static Date toDate(final LocalDateTime localDateTime); static Date toDate(final LocalDate localDate); static LocalDateTime fromD...
### Question: BlockEvent { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final BlockEvent that = (BlockEvent) o; return Objects.equals(time, that.time) && Objects.equals(type, that.type); } BlockEvent(final LocalDateTime time, final in...
### Question: BlockEvents { public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } BlockEvents(final String prefix, final List<BlockEvent> blockEvents); String getPrefix(); int getTemporaryBlockCount(); boolean isPermanentBlockRequired(); static final int NR_TE...
### Question: ConcurrentState { public void set(final Boolean value) { updates.add(value); } void set(final Boolean value); void waitUntil(final Boolean value); }### Answer: @Test public void set_and_unset_state() { Counter counter = new Counter(); new Thread(counter).start(); subject.set(true); waitForExpectedValue(...
### Question: IpResourceTree { public V getValue(IpInterval<?> ipInterval) { List<V> list = getTree(ipInterval).findExactOrFirstLessSpecific(ipInterval); return CollectionHelper.uniqueResult(list); } @SuppressWarnings({"unchecked", "rawtypes"}) IpResourceTree(); void add(IpInterval<?> ipInterval, V value); V getValue(...
### Question: AutomaticPermanentBlocks implements DailyScheduledTask { @Override @Scheduled(cron = "0 0 0 * * *") @SchedulerLock(name = "AutomaticPermanentBlocks") public void run() { final LocalDate now = dateTimeProvider.getCurrentDate(); final LocalDate checkTemporaryBlockTime = now.minusDays(30); final List<BlockEv...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public void put(K key, V value) { synchronized (mutex) { wrapped.put(key, value); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped, final Object mutex); s...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public void remove(K key) { synchronized (mutex) { wrapped.remove(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped, final Object mutex); static Inte...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findFirstLessSpecific(K key) { synchronized (mutex) { return wrapped.findFirstLessSpecific(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> w...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findAllLessSpecific(K key) { synchronized (mutex) { return wrapped.findAllLessSpecific(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> wrapp...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactAndAllLessSpecific(K key) { synchronized (mutex) { return wrapped.findExactAndAllLessSpecific(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final Interva...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExact(K key) { synchronized (mutex) { return wrapped.findExact(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped, final Object mut...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactOrFirstLessSpecific(K key) { synchronized (mutex) { return wrapped.findExactOrFirstLessSpecific(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final Inter...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findFirstMoreSpecific(K key) { synchronized (mutex) { return wrapped.findFirstMoreSpecific(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> w...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findAllMoreSpecific(K key) { synchronized (mutex) { return wrapped.findAllMoreSpecific(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> wrapp...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactAndAllMoreSpecific(K key) { synchronized (mutex) { return wrapped.findExactAndAllMoreSpecific(key); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final Interva...
### Question: SynchronizedIntervalMap implements IntervalMap<K, V> { @Override public void clear() { synchronized (mutex) { wrapped.clear(); } } private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped); private SynchronizedIntervalMap(final IntervalMap<K, V> wrapped, final Object mutex); static IntervalMap<K,...
### Question: InternalNode { void addChild(InternalNode<K, V> nodeToAdd) { if (interval.equals(nodeToAdd.getInterval())) { this.value = nodeToAdd.getValue(); } else if (!interval.contains(nodeToAdd.getInterval())) { throw new IllegalArgumentException(nodeToAdd.getInterval() + " not properly contained in " + interval); ...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public void clear() { children.clear(); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override List<V> findFirst...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public void put(K key, V value) { Validate.notNull(key); Validate.notNull(value); children.addChild(new InternalNode<>(key, value)); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value); @Ov...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public void remove(K key) { Validate.notNull(key); children.removeChild(key); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key,...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findAllLessSpecific(K key) { Validate.notNull(key); return mapToValues(internalFindAllLessSpecific(key)); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value); @Override void ...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactAndAllLessSpecific(K key) { Validate.notNull(key); return mapToValues(internalFindExactAndAllLessSpecific(key)); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value);...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactOrFirstLessSpecific(K key) { Validate.notNull(key); return mapToValues(internalFindExactOrFirstLessSpecific(key)); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findFirstLessSpecific(K key) { Validate.notNull(key); InternalNode<K, V> node = internalFindFirstLessSpecific(key); return mapToValues(node); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void ...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findFirstMoreSpecific(K key) { Validate.notNull(key); return mapToValues(internalFindFirstMoreSpecific(key)); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value); @Override v...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExact(K key) { Validate.notNull(key); InternalNode<K, V> node = internalFindExact(key); return mapToValues(node); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value); @Ov...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findAllMoreSpecific(K key) { Validate.notNull(key); return mapToValues(internalFindAllMoreSpecific(key)); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value); @Override void ...
### Question: NestedIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactAndAllMoreSpecific(K key) { Validate.notNull(key); return mapToValues(internalFindExactAndAllMoreSpecific(key)); } NestedIntervalMap(); NestedIntervalMap(NestedIntervalMap<K, V> source); @Override void put(K key, V value);...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExact(K key) { return unroll(wrapped.findExact(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override void clear(); @Override List...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public void remove(K key) { wrapped.remove(key); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override void clear(); @Override List<V> findFirstLessSpecifi...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public void clear() { wrapped.clear(); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override void clear(); @Override List<V> findFirstLessSpecific(K key); ...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findFirstLessSpecific(K key) { return unroll(wrapped.findFirstLessSpecific(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override void...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactOrFirstLessSpecific(K key) { return unroll(wrapped.findExactOrFirstLessSpecific(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); ...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findAllLessSpecific(K key) { return unroll(wrapped.findAllLessSpecific(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override void cle...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactAndAllLessSpecific(K key) { return unroll(wrapped.findExactAndAllLessSpecific(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @O...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findFirstMoreSpecific(K key) { return unroll(wrapped.findFirstMoreSpecific(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override void...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findAllMoreSpecific(K key) { return unroll(wrapped.findAllMoreSpecific(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @Override void cle...
### Question: MultiValueIntervalMap implements IntervalMap<K, V> { @Override public List<V> findExactAndAllMoreSpecific(K key) { return unroll(wrapped.findExactAndAllMoreSpecific(key)); } MultiValueIntervalMap(); @Override void put(K key, V value); @Override void remove(K key); @Override void remove(K key, V value); @O...
### Question: AuthoritativeResourceDataValidator { void checkOverlaps(final Writer writer) throws IOException { for (int i1 = 0; i1 < sources.size(); i1++) { for (int i2 = i1 + 1; i2 < sources.size(); i2++) { final CIString source1 = sources.get(i1); final CIString source2 = sources.get(i2); checkOverlaps(writer, sourc...
### Question: AuthoritativeResourceData { public AuthoritativeResource getAuthoritativeResource(final CIString source) { final String sourceName = StringUtils.removeEnd(source.toLowerCase(), "-grs"); final AuthoritativeResource authoritativeResource = authoritativeResourceCache.get(sourceName); if (authoritativeResourc...
### Question: AuthoritativeResource { public static AuthoritativeResource loadFromFile(final Logger logger, final String name, final Path path) { try (final Scanner scanner = new Scanner(path)) { return loadFromScanner(logger, name, scanner); } catch (IOException e) { throw new IllegalArgumentException(e); } } Authorit...
### Question: AuthoritativeResourceDataJmx extends JmxBase { @ManagedOperation(description = "Refresh authoritative resource cache") @ManagedOperationParameters({ @ManagedOperationParameter(name = "comment", description = "Optional comment for invoking the operation") }) public String refreshCache(final String comment)...
### Question: RpslObjectFilter { public static boolean isFiltered(final RpslObject rpslObject) { final List<RpslAttribute> attributes = rpslObject.findAttributes(AttributeType.SOURCE); return !attributes.isEmpty() && attributes.get(0).getValue().contains(FILTERED); } private RpslObjectFilter(); static String getCertif...
### Question: Changed { public static Changed parse(final CIString value) { return parse(value.toString()); } Changed(final CIString email, final LocalDate date); Changed(final String email, final LocalDate date); String getEmail(); @CheckForNull LocalDate getDate(); @CheckForNull String getDateString(); @Override Str...
### Question: AddressPrefixRange { public static AddressPrefixRange parse(final CIString value) { return parse(value.toString()); } private AddressPrefixRange(final String value, final IpInterval ipInterval, final RangeOperation rangeOperation); IpInterval getIpInterval(); RangeOperation getRangeOperation(); @Override...
### Question: NServer { public static NServer parse(final CIString value) { return parse(value.toString()); } private NServer(final CIString hostname, final IpInterval ipInterval); CIString getHostname(); @CheckForNull IpInterval getIpInterval(); @Override String toString(); static NServer parse(final CIString value);...
### Question: Domain { public static Domain parse(final CIString value) { return parse(value.toString()); } private Domain(final CIString value, final IpInterval<?> reverseIp, final Type type, final boolean dashNotation); CIString getValue(); Type getType(); @CheckForNull IpInterval<?> getReverseIp(); boolean endsWith...
### Question: ObjectMessages { public Messages getMessages() { return messages; } Messages getMessages(); Map<RpslAttribute, Messages> getAttributeMessages(); boolean contains(final Message message); void addMessage(final Message message); void addMessage(final RpslAttribute attribute, final Message message); Messages...
### Question: ObjectMessages { public void addAll(final ObjectMessages objectMessages) { messages.addAll(objectMessages.messages); for (final Map.Entry<RpslAttribute, Messages> entry : objectMessages.attributeMessages.entrySet()) { getMessages(entry.getKey()).addAll(entry.getValue()); } } Messages getMessages(); Map<R...
### Question: ObjectTemplate implements Comparable<ObjectTemplate> { public static ObjectTemplate getTemplate(final ObjectType type) { final ObjectTemplate objectTemplate = TEMPLATE_MAP.get(type); if (objectTemplate == null) { throw new IllegalStateException("No template for " + type); } return objectTemplate; } privat...
### Question: ObjectTemplate implements Comparable<ObjectTemplate> { public ObjectType getObjectType() { return objectType; } private ObjectTemplate(final ObjectType objectType, final int orderPosition, final AttributeTemplate... attributeTemplates); static ObjectTemplate getTemplate(final ObjectType type); static Col...
### Question: ObjectTemplate implements Comparable<ObjectTemplate> { public Set<AttributeType> getMultipleAttributes() { return multipleAttributes; } private ObjectTemplate(final ObjectType objectType, final int orderPosition, final AttributeTemplate... attributeTemplates); static ObjectTemplate getTemplate(final Obje...
### Question: ObjectTemplate implements Comparable<ObjectTemplate> { public boolean isSet() { return ObjectType.getSets().contains(objectType); } private ObjectTemplate(final ObjectType objectType, final int orderPosition, final AttributeTemplate... attributeTemplates); static ObjectTemplate getTemplate(final ObjectTy...
### Question: RpslObject implements Identifiable, ResponseObject { public final CIString getKey() { return key; } RpslObject(final RpslObject oldObject, final List<RpslAttribute> attributes); RpslObject(final Integer objectId, final List<RpslAttribute> attributes); RpslObject(final Integer objectId, final RpslObject ...
### Question: RpslObject implements Identifiable, ResponseObject { public boolean containsAttribute(final AttributeType attributeType) { return getOrCreateCache().containsKey(attributeType); } RpslObject(final RpslObject oldObject, final List<RpslAttribute> attributes); RpslObject(final Integer objectId, final List<Rp...
### Question: RpslObject implements Identifiable, ResponseObject { public CIString getValueForAttribute(final AttributeType attributeType) { return findAttribute(attributeType).getCleanValue(); } RpslObject(final RpslObject oldObject, final List<RpslAttribute> attributes); RpslObject(final Integer objectId, final List...
### Question: RpslAttribute { public void validateSyntax(final ObjectType objectType, final ObjectMessages objectMessages) { for (final CIString cleanValue : getCleanValues()) { if (!type.getSyntax().matches(objectType, cleanValue.toString())) { objectMessages.addMessage(this, ValidationMessages.syntaxError(cleanValue....
### Question: RpslAttribute { @Override public String toString() { try { final StringWriter writer = new StringWriter(); writeTo(writer); return writer.toString(); } catch (IOException e) { throw new IllegalStateException("Should never occur", e); } } RpslAttribute(final AttributeType attributeType, final CIString valu...
### Question: RpslAttribute { public String getCleanComment() { if (cleanValues == null) { extractCleanValueAndComment(value); } return cleanComment; } RpslAttribute(final AttributeType attributeType, final CIString value); RpslAttribute(final AttributeType attributeType, final String value); RpslAttribute(final Stri...
### Question: ParserHelper { public static void validateMoreSpecificsOperator(final String yytext) { int val = Integer.valueOf(yytext.substring(1)); if (val > MAX_BIT_LENGTH_IPV4) { syntaxError("more specifics operator " + yytext.substring(1) + " not 0 to 32 bits"); } } private ParserHelper(); static void check16bit(f...
### Question: ParserHelper { public static void validateAsNumber(final String yytext) { final long value = Long.valueOf(yytext.substring(2)); if (value > MAX_32BIT_NUMBER) { syntaxError("AS Number " + yytext + " length is invalid"); } } private ParserHelper(); static void check16bit(final String number); static void c...
### Question: ParserHelper { public static void validateIpv4(final String yytext) { try { Ipv4Resource.parse(yytext); } catch (IllegalArgumentException e) { syntaxError("IP address " + yytext + " contains an invalid octet"); } } private ParserHelper(); static void check16bit(final String number); static void check32bi...
### Question: ByteArrayOutput extends OutputStream { public void write(final int b) { final int newcount = count + 1; if (newcount > buf.length) { buf = Arrays.copyOf(buf, Math.max(buf.length << 1, newcount)); } buf[count] = (byte) b; count = newcount; } ByteArrayOutput(); ByteArrayOutput(final int initialCapacity); v...
### Question: ByteArrayOutput extends OutputStream { public void reset() { count = 0; } ByteArrayOutput(); ByteArrayOutput(final int initialCapacity); void write(final int b); void write(final byte b[]); void write(final byte b[], final int off, final int len); void reset(); byte[] toByteArray(); int size(); }### Ans...
### Question: ByteArrayOutput extends OutputStream { public int size() { return count; } ByteArrayOutput(); ByteArrayOutput(final int initialCapacity); void write(final int b); void write(final byte b[]); void write(final byte b[], final int off, final int len); void reset(); byte[] toByteArray(); int size(); }### An...
### Question: Ipv4Resource extends IpInterval<Ipv4Resource> implements Comparable<Ipv4Resource> { @Override public Ipv4Resource singletonIntervalAtLowerBound() { return new Ipv4Resource(this.begin(), this.begin()); } private Ipv4Resource(final int begin, final int end); Ipv4Resource(final long begin, final long end);...
### Question: ResourceTagger { void tagObjects(final GrsSource grsSource) { final Stopwatch stopwatch = Stopwatch.createStarted(); try { sourceContext.setCurrent(Source.master(grsSource.getName())); if (sourceContext.isTagRoutes()) { tagRouteObjectsInContext(grsSource); } tagsDao.deleteOrphanedTags(); } finally { sourc...
### Question: GrsSource implements InitializingBean { @Override public String toString() { return name.toString(); } GrsSource(final String name, final SourceContext sourceContext, final DateTimeProvider dateTimeProvider, final AuthoritativeResourceData authoritativeResourceData, final Downloader downloader); @Override...
### Question: IpInterval implements Interval<K> { public static IpInterval<?> parseReverseDomain(final String reverse) { final String result = removeTrailingDot(reverse).toLowerCase(); if (result.endsWith(Ipv4Resource.IPV4_REVERSE_DOMAIN)) { return Ipv4Resource.parseReverseDomain(result); } return Ipv6Resource.parseRev...