target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void iterable_resettable() { final Iterable<Integer> subject = getSimpleIterable(1,2,3); Iterator<Integer> iterator = subject.iterator(); assertTrue(iterator.hasNext()); assertThat(iterator.next(), is(1)); iterator = subject.iterator(); assertTrue(iterator.hasNext()); assertThat(iterator.next(), is(1)); as... | @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); IterableTransformer<T> setHeader(T... header); IterableTransformer<T> setHeader(Collection<T> header); abstract void apply(final T input, ... | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); IterableTransformer<T> setHeader(T... header); IterableTransformer<T> setHeader(Collection<T> header); abstract void apply(final T input, ... |
@Test public void getAction() { assertThat(subject.getAction(), is(Action.MODIFY)); } | public Action getAction() { return action; } | PreparedUpdate implements UpdateContainer { public Action getAction() { return action; } } | PreparedUpdate implements UpdateContainer { public Action getAction() { return action; } PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullable final RpslObject updatedObject, final Action action); PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullabl... | PreparedUpdate implements UpdateContainer { public Action getAction() { return action; } PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullable final RpslObject updatedObject, final Action action); PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullabl... | PreparedUpdate implements UpdateContainer { public Action getAction() { return action; } PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullable final RpslObject updatedObject, final Action action); PreparedUpdate(final Update update, @Nullable final RpslObject originalObject, @Nullabl... |
@Test public void getCredentials() { subject.getCredentials(); verify(update).getCredentials(); } | public Credentials getCredentials() { return update.getCredentials(); } | PreparedUpdate implements UpdateContainer { public Credentials getCredentials() { return update.getCredentials(); } } | 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 final RpslObje... | 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 final RpslObje... | 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 final RpslObje... |
@Test public void getType() { subject.getType(); verify(update).getType(); } | public ObjectType getType() { return update.getType(); } | PreparedUpdate implements UpdateContainer { public ObjectType getType() { return update.getType(); } } | 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 RpslObject originalObje... | 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 RpslObject originalObje... | 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 RpslObject originalObje... |
@Test public void getKey() { assertThat(subject.getFormattedKey(), is("[mntner] DEV-TST-MNT")); } | public String getKey() { return updatedObject.getKey().toString(); } | PreparedUpdate implements UpdateContainer { public String getKey() { return updatedObject.getKey().toString(); } } | 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 final RpslObject ... | 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 final RpslObject ... | 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 final RpslObject ... |
@Test public void newValues_create() { subject = new PreparedUpdate( update, null, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), Action.CREATE); final Set<CIString> newValues = subject.getNewValues(AttributeType.MNT_BY); assertThat(newValues, contains(ciString("DEV-MNT-1"... | public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValues; } | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... |
@Test public void newValues_modify_added() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), Action.MODIFY); final Set<CIString> newValues = subject.getNewValues(Attr... | public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValues; } | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... |
@Test public void newValues_modify_added_unavailable_attribute() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), Action.MODIFY); final Set<CIString> newValues = sub... | public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValues; } | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... |
@Test public void newValues_modify_removed() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-2\n"), Action.MODIFY); final Set<CIString> newValues = subject.getNewValues(At... | public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValues; } | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... |
@Test public void newValues_modify_delete() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n"), Action.DELETE); final Set<CIString> newValues = subject.getNewValues(AttributeType.MNT_BY); asse... | public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValues; } | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... | PreparedUpdate implements UpdateContainer { public Set<CIString> getNewValues(final AttributeType attributeType) { final Set<CIString> newValues = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null) { newValues.removeAll(originalObject.getValuesForAttribute(attributeType)); } return newValue... |
@Test public void differentValues_create() { subject = new PreparedUpdate( update, null, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), Action.CREATE); final Set<CIString> differences = subject.getDifferences(AttributeType.MNT_BY); assertThat(differences, contains(ciString... | public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, originalObject.getValuesForAttribute(attributeType))... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... |
@Test public void odd_filter_test() { final Iterable<Integer> subject = getOddFilteringIterable(1, 2, 3); final Iterator<Integer> iterator = subject.iterator(); assertTrue(iterator.hasNext()); assertThat(iterator.next(), is(2)); assertFalse(iterator.hasNext()); } | @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); IterableTransformer<T> setHeader(T... header); IterableTransformer<T> setHeader(Collection<T> header); abstract void apply(final T input, ... | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); IterableTransformer<T> setHeader(T... header); IterableTransformer<T> setHeader(Collection<T> header); abstract void apply(final T input, ... |
@Test public void differentValues_modify_added() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), Action.MODIFY); final Set<CIString> differences = subject.getDiffer... | public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, originalObject.getValuesForAttribute(attributeType))... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... |
@Test public void differentValues_modify_added_unavailable_attribute() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), Action.MODIFY); final Set<CIString> differenc... | public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, originalObject.getValuesForAttribute(attributeType))... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... |
@Test public void differentValues_modify_removed() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-2\n"), Action.MODIFY); final Set<CIString> differences = subject.getDiff... | public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, originalObject.getValuesForAttribute(attributeType))... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... |
@Test public void differentValues_modify_delete() { subject = new PreparedUpdate( update, RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), RpslObject.parse("" + "inetnum: 10.0.0.0\n" + "mnt-by: DEV-MNT-1\n" + "mnt-by: DEV-MNT-2\n"), Action.DELETE); final Set<CIString> differ... | public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, originalObject.getValuesForAttribute(attributeType))... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... | PreparedUpdate implements UpdateContainer { public Set<CIString> getDifferences(final AttributeType attributeType) { Set<CIString> differences = updatedObject.getValuesForAttribute(attributeType); if (originalObject != null && !Action.DELETE.equals(action)) { differences = Sets.symmetricDifference(differences, original... |
@Test public void authentication_failed_empty_list() { RpslObject object = RpslObject.parse("person: New Person\nnic-hdl: AUTO-1"); final Message result = UpdateMessages.authenticationFailed(object, AttributeType.MNT_BY, Lists.<RpslObject>newArrayList()); assertThat(result.toString(), is( "Authorisation for [person] AU... | public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" + "Authorisation ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... |
@Test public void authentication_failed_with_list() { RpslObject object = RpslObject.parse("person: New Person\nnic-hdl: AUTO-1\nmnt-by: maintainer"); RpslObject mntner = RpslObject.parse("mntner: maintainer"); final Message result = UpdateMessages.authenticationFailed(object, AttributeType.MNT_BY, Lists.newArrayList(m... | public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" + "Authorisation ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... | UpdateMessages { public static Message authenticationFailed(final RpslObject object, final AttributeType attributeType, final Iterable<RpslObject> candidates) { final CharSequence joined = LIST_JOINED.join( Iterables.transform(candidates,input -> input == null ? "" : input.getKey())); return new Message(Type.ERROR, "" ... |
@Test public void equals() { final ObjectKey subject = new ObjectKey(ObjectType.MNTNER, "key"); assertThat(subject.equals(null), is(false)); assertThat(subject.equals(""), is(false)); assertThat(subject.equals(subject), is(true)); assertThat(subject.equals(new ObjectKey(ObjectType.MNTNER, "key")), is(true)); assertThat... | @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 { @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 { @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 objectType, final Strin... | 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 objectType, final Strin... | 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 objectType, final Strin... |
@Test public void hash() { final ObjectKey subject = new ObjectKey(ObjectType.MNTNER, "key"); assertThat(subject.hashCode(), is(new ObjectKey(ObjectType.MNTNER, "key").hashCode())); assertThat(subject.hashCode(), not(is(new ObjectKey(ObjectType.ORGANISATION, "key").hashCode()))); } | @Override public int hashCode() { return Objects.hash(objectType, pkey); } | ObjectKey { @Override public int hashCode() { return Objects.hash(objectType, pkey); } } | ObjectKey { @Override public int hashCode() { return Objects.hash(objectType, pkey); } ObjectKey(final ObjectType objectType, final String pkey); ObjectKey(final ObjectType objectType, final CIString pkey); } | 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 hashCode(); @O... | 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 hashCode(); @O... |
@Test public void hash_uppercase() { final ObjectKey subject = new ObjectKey(ObjectType.MNTNER, "key"); assertThat(subject.hashCode(), is(new ObjectKey(ObjectType.MNTNER, "KEY").hashCode())); } | @Override public int hashCode() { return Objects.hash(objectType, pkey); } | ObjectKey { @Override public int hashCode() { return Objects.hash(objectType, pkey); } } | ObjectKey { @Override public int hashCode() { return Objects.hash(objectType, pkey); } ObjectKey(final ObjectType objectType, final String pkey); ObjectKey(final ObjectType objectType, final CIString pkey); } | 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 hashCode(); @O... | 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 hashCode(); @O... |
@Test public void string() { final ObjectKey subject = new ObjectKey(ObjectType.MNTNER, "key"); assertThat(subject.toString(), is("[mntner] key")); } | @Override public String toString() { return String.format("[%s] %s", objectType.getName(), pkey); } | ObjectKey { @Override public String toString() { return String.format("[%s] %s", objectType.getName(), pkey); } } | 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); } | 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(Object o); @Ov... | 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(Object o); @Ov... |
@Test public void multiple_results_filter_test() { final Iterable<Integer> subject = getOddFilteringEvenDoublingIterable(1, 2, 3); final Iterator<Integer> iterator = subject.iterator(); assertTrue(iterator.hasNext()); assertThat(iterator.next(), is(2)); assertTrue(iterator.hasNext()); assertThat(iterator.next(), is(2))... | @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); } | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); IterableTransformer<T> setHeader(T... header); IterableTransformer<T> setHeader(Collection<T> header); abstract void apply(final T input, ... | IterableTransformer implements Iterable<T> { @Override public Iterator<T> iterator() { return new IteratorTransformer(head); } IterableTransformer(final Iterable<? extends T> wrap); IterableTransformer<T> setHeader(T... header); IterableTransformer<T> setHeader(Collection<T> header); abstract void apply(final T input, ... |
@Test public void string_uppercase() { final ObjectKey subject = new ObjectKey(ObjectType.MNTNER, "KeY"); assertThat(subject.toString(), is("[mntner] KeY")); } | @Override public String toString() { return String.format("[%s] %s", objectType.getName(), pkey); } | ObjectKey { @Override public String toString() { return String.format("[%s] %s", objectType.getName(), pkey); } } | 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); } | 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(Object o); @Ov... | 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(Object o); @Ov... |
@Test public void getEmail() { assertThat(subject.getEmail(), is("test@me.now")); } | public String getEmail() { return email; } | Notification { public String getEmail() { return email; } } | Notification { public String getEmail() { return email; } Notification(final String email); } | 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); } | 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); } |
@Test public void getUpdates_empty() { for (final Notification.Type type : Notification.Type.values()) { assertThat(subject.getUpdates(type), hasSize(0)); } } | public Set<Update> getUpdates(final Type type) { return updates.get(type); } | Notification { public Set<Update> getUpdates(final Type type) { return updates.get(type); } } | Notification { public Set<Update> getUpdates(final Type type) { return updates.get(type); } Notification(final String email); } | 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); } | 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); } |
@Test public void has_empty() { for (final Notification.Type type : Notification.Type.values()) { assertThat(subject.has(type), is(false)); } } | public boolean has(final Type type) { return !updates.get(type).isEmpty(); } | Notification { public boolean has(final Type type) { return !updates.get(type).isEmpty(); } } | Notification { public boolean has(final Type type) { return !updates.get(type).isEmpty(); } Notification(final String email); } | 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); } | 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); } |
@Test public void string_representation() { final RpslObject updatedObject = RpslObject.parse("mntner: DEV-ROOT-MNT\nsource: RIPE #Filtered\ninvalid: invalid\nmnt-by: MNT2"); when(update.getType()).thenReturn(ObjectType.MNTNER); when(update.getSubmittedObject()).thenReturn(updatedObject); final ObjectMessages objectMes... | @Override public String toString() { final Writer writer = new StringWriter(); try { toString(writer); return writer.toString(); } catch (IOException e) { throw new IllegalStateException("Should not occur", e); } } | UpdateResult { @Override public String toString() { final Writer writer = new StringWriter(); try { toString(writer); return writer.toString(); } catch (IOException e) { throw new IllegalStateException("Should not occur", e); } } } | UpdateResult { @Override public String toString() { final Writer writer = new StringWriter(); try { toString(writer); return writer.toString(); } catch (IOException e) { throw new IllegalStateException("Should not occur", e); } } UpdateResult(@Nullable final RpslObject originalObject, final RpslObject updatedObject, fi... | UpdateResult { @Override public String toString() { final Writer writer = new StringWriter(); try { toString(writer); return writer.toString(); } catch (IOException e) { throw new IllegalStateException("Should not occur", e); } } UpdateResult(@Nullable final RpslObject originalObject, final RpslObject updatedObject, fi... | UpdateResult { @Override public String toString() { final Writer writer = new StringWriter(); try { toString(writer); return writer.toString(); } catch (IOException e) { throw new IllegalStateException("Should not occur", e); } } UpdateResult(@Nullable final RpslObject originalObject, final RpslObject updatedObject, fi... |
@Test public void pgp_credentials() { final Credential credential1 = Mockito.mock(Credential.class); final Credential credential2 = Mockito.mock(Credential.class); final PgpCredential pgpCredential = Mockito.mock(PgpCredential.class); final Credentials subject = new Credentials(Sets.newHashSet(credential1, credential2,... | public boolean has(final Class<? extends Credential> clazz) { return !ofType(clazz).isEmpty(); } | Credentials { public boolean has(final Class<? extends Credential> clazz) { return !ofType(clazz).isEmpty(); } } | Credentials { public boolean has(final Class<? extends Credential> clazz) { return !ofType(clazz).isEmpty(); } Credentials(); Credentials(final Set<? extends Credential> credentials); } | 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); Set<T> ofType(fi... | 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); Set<T> ofType(fi... |
@Test public void is_signed_with_one_pgp_credential() { final Paragraph paragraph = new Paragraph(content, new Credentials(Sets.newHashSet(PgpCredential.createKnownCredential("PGPKEY-AAAAAAAA")))); Update subject = new Update(paragraph, Operation.UNSPECIFIED, Lists.<String>newArrayList(), rpslObject); assertThat(subjec... | public boolean isSigned() { return paragraph.getCredentials().has(PgpCredential.class) || paragraph.getCredentials().has(X509Credential.class); } | Update implements UpdateContainer { public boolean isSigned() { return paragraph.getCredentials().has(PgpCredential.class) || paragraph.getCredentials().has(X509Credential.class); } } | 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 submittedObject)... | 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 submittedObject)... | 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 submittedObject)... |
@Test public void is_signed_with_one_x509_credential() { final Paragraph paragraph = new Paragraph(content, new Credentials(Sets.newHashSet(X509Credential.createKnownCredential("X509-1")))); Update subject = new Update(paragraph, Operation.UNSPECIFIED, Lists.<String>newArrayList(), rpslObject); assertThat(subject.isSig... | public boolean isSigned() { return paragraph.getCredentials().has(PgpCredential.class) || paragraph.getCredentials().has(X509Credential.class); } | Update implements UpdateContainer { public boolean isSigned() { return paragraph.getCredentials().has(PgpCredential.class) || paragraph.getCredentials().has(X509Credential.class); } } | 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 submittedObject)... | 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 submittedObject)... | 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 submittedObject)... |
@Test public void is_not_signed_with_one_password_credential() { final Paragraph paragraph = new Paragraph(content, new Credentials(Sets.newHashSet(new PasswordCredential("password")))); Update subject = new Update(paragraph, Operation.UNSPECIFIED, Lists.<String>newArrayList(), rpslObject); assertThat(subject.isSigned(... | public boolean isSigned() { return paragraph.getCredentials().has(PgpCredential.class) || paragraph.getCredentials().has(X509Credential.class); } | Update implements UpdateContainer { public boolean isSigned() { return paragraph.getCredentials().has(PgpCredential.class) || paragraph.getCredentials().has(X509Credential.class); } } | 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 submittedObject)... | 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 submittedObject)... | 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 submittedObject)... |
@Test public void is_override() { final Paragraph paragraph = new Paragraph(content, new Credentials(Sets.newHashSet(OverrideCredential.parse("username,password")))); Update subject = new Update(paragraph, Operation.UNSPECIFIED, Lists.<String>newArrayList(), rpslObject); assertThat(subject.isOverride(), is(true)); } | public boolean isOverride() { return paragraph.getCredentials().has(OverrideCredential.class); } | Update implements UpdateContainer { public boolean isOverride() { return paragraph.getCredentials().has(OverrideCredential.class); } } | 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); } | 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(); Paragraph getPara... | 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(); Paragraph getPara... |
@Test(expected = UnsupportedOperationException.class) public void test_remove() throws Exception { ProxyLoader<Integer, String> proxyLoader = Mockito.mock(ProxyLoader.class); subject = new ProxyIterable<>(Collections.<Integer>emptyList(), proxyLoader, 1); subject.iterator().remove(); } | @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.hasNext(); } @Override public R next() { if (idx == b... | 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.hasNext(); } @... | 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.hasNext(); } @... | 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.hasNext(); } @... | 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.hasNext(); } @... |
@Test public void is_not_override() { final Paragraph paragraph = new Paragraph(content, new Credentials(Sets.newHashSet(new PasswordCredential("password")))); Update subject = new Update(paragraph, Operation.UNSPECIFIED, Lists.<String>newArrayList(), rpslObject); assertThat(subject.isOverride(), is(false)); } | public boolean isOverride() { return paragraph.getCredentials().has(OverrideCredential.class); } | Update implements UpdateContainer { public boolean isOverride() { return paragraph.getCredentials().has(OverrideCredential.class); } } | 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); } | 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(); Paragraph getPara... | 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(); Paragraph getPara... |
@Test public void multiple_connected_same_ip() throws Exception { final InetSocketAddress remoteAddress = new InetSocketAddress("10.0.0.0", 43); when(channel.getRemoteAddress()).thenReturn(remoteAddress); final ChannelEvent openEvent = new UpstreamChannelStateEvent(channel, ChannelState.OPEN, Boolean.TRUE); subject.han... | private boolean connectionsExceeded(final InetAddress remoteAddresss) { final Integer count = connectionCounter.increment(remoteAddresss); return (count != null && count > maxConnectionsPerIp); } | NrtmConnectionPerIpLimitHandler extends SimpleChannelUpstreamHandler { private boolean connectionsExceeded(final InetAddress remoteAddresss) { final Integer count = connectionCounter.increment(remoteAddresss); return (count != null && count > maxConnectionsPerIp); } } | NrtmConnectionPerIpLimitHandler extends SimpleChannelUpstreamHandler { private boolean connectionsExceeded(final InetAddress remoteAddresss) { final Integer count = connectionCounter.increment(remoteAddresss); return (count != null && count > maxConnectionsPerIp); } @Autowired NrtmConnectionPerIpLimitHandler(
... | NrtmConnectionPerIpLimitHandler extends SimpleChannelUpstreamHandler { private boolean connectionsExceeded(final InetAddress remoteAddresss) { final Integer count = connectionCounter.increment(remoteAddresss); return (count != null && count > maxConnectionsPerIp); } @Autowired NrtmConnectionPerIpLimitHandler(
... | NrtmConnectionPerIpLimitHandler extends SimpleChannelUpstreamHandler { private boolean connectionsExceeded(final InetAddress remoteAddresss) { final Integer count = connectionCounter.increment(remoteAddresss); return (count != null && count > maxConnectionsPerIp); } @Autowired NrtmConnectionPerIpLimitHandler(
... |
@Test public void read_one_line() throws Exception { mockRead("aaa\n"); SocketChannelFactory.Reader reader = SocketChannelFactory.createReader(socketChannel); assertThat(reader.readLine(), is("aaa")); } | public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } | SocketChannelFactory { public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } } | SocketChannelFactory { public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } private SocketChannelFactory(); } | 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); static Writer cre... | 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); static Writer cre... |
@Test public void read_empty_line() throws Exception { mockRead("\n"); SocketChannelFactory.Reader reader = SocketChannelFactory.createReader(socketChannel); assertThat(reader.readLine(), is("")); } | public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } | SocketChannelFactory { public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } } | SocketChannelFactory { public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } private SocketChannelFactory(); } | 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); static Writer cre... | 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); static Writer cre... |
@Test public void read_multiple_lines() throws Exception { mockRead("aaa\nbbb\nccc\n"); SocketChannelFactory.Reader reader = SocketChannelFactory.createReader(socketChannel); assertThat(reader.readLine(), is("aaa")); assertThat(reader.readLine(), is("bbb")); assertThat(reader.readLine(), is("ccc")); } | public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } | SocketChannelFactory { public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } } | SocketChannelFactory { public static Reader createReader(final SocketChannel socketChannel) { return new Reader(socketChannel); } private SocketChannelFactory(); } | 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); static Writer cre... | 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); static Writer cre... |
@Test public void write_line() throws Exception { mockWrite("aaa\n"); SocketChannelFactory.Writer writer = SocketChannelFactory.createWriter(socketChannel); writer.writeLine("aaa"); } | public static Writer createWriter(final SocketChannel socketChannel) { return new Writer(socketChannel); } | SocketChannelFactory { public static Writer createWriter(final SocketChannel socketChannel) { return new Writer(socketChannel); } } | SocketChannelFactory { public static Writer createWriter(final SocketChannel socketChannel) { return new Writer(socketChannel); } private SocketChannelFactory(); } | 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); static Writer cre... | 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); static Writer cre... |
@Test(expected = IllegalArgumentException.class) public void invalid_source() { when(sourceContext.isVirtual(CIString.ciString("1-GRS"))).thenReturn(true); subject.checkSources(); } | @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)); } JdbcRpslObjectOperations.sanityCheck(sourceContext.getSourceConfiguration(Source.master(source)).get... | 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)); } JdbcRpslObjectOperations.sa... | 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)); } JdbcRpslObjectOperations.sa... | 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)); } JdbcRpslObjectOperations.sa... | 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)); } JdbcRpslObjectOperations.sa... |
@Test public void start() { when(valueResolver.resolveStringValue("${nrtm.import.1-GRS.source}")).thenReturn("RIPE"); when(valueResolver.resolveStringValue("${nrtm.import.1-GRS.host}")).thenReturn("localhost"); when(valueResolver.resolveStringValue("${nrtm.import.1-GRS.port}")).thenReturn("1044"); when(nrtmClientFactor... | @Override public void start() { if (!enabled) { return; } final List<NrtmSource> nrtmSources = readNrtmSources(); if (nrtmSources.size() > 0) { LOGGER.info("Initializing thread pool with {} thread(s)", nrtmSources.size()); executorService = Executors.newFixedThreadPool(nrtmSources.size(), new ThreadFactory() { final Th... | NrtmImporter implements EmbeddedValueResolverAware, ApplicationService { @Override public void start() { if (!enabled) { return; } final List<NrtmSource> nrtmSources = readNrtmSources(); if (nrtmSources.size() > 0) { LOGGER.info("Initializing thread pool with {} thread(s)", nrtmSources.size()); executorService = Execut... | NrtmImporter implements EmbeddedValueResolverAware, ApplicationService { @Override public void start() { if (!enabled) { return; } final List<NrtmSource> nrtmSources = readNrtmSources(); if (nrtmSources.size() > 0) { LOGGER.info("Initializing thread pool with {} thread(s)", nrtmSources.size()); executorService = Execut... | NrtmImporter implements EmbeddedValueResolverAware, ApplicationService { @Override public void start() { if (!enabled) { return; } final List<NrtmSource> nrtmSources = readNrtmSources(); if (nrtmSources.size() > 0) { LOGGER.info("Initializing thread pool with {} thread(s)", nrtmSources.size()); executorService = Execut... | NrtmImporter implements EmbeddedValueResolverAware, ApplicationService { @Override public void start() { if (!enabled) { return; } final List<NrtmSource> nrtmSources = readNrtmSources(); if (nrtmSources.size() > 0) { LOGGER.info("Initializing thread pool with {} thread(s)", nrtmSources.size()); executorService = Execut... |
@Test public void gFlagWithVersion2Works() { when(dummifierMock.isAllowed(2, person)).thenReturn(true); when(dummifierMock.isAllowed(2, inetnum)).thenReturn(true); when(dummifierMock.dummify(2, inetnum)).thenReturn(inetnum); when(dummifierMock.dummify(2, person)).thenReturn(DummifierNrtm.getPlaceholderPersonObject()); ... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void qFlagVersionArgument() { when(messageEventMock.getMessage()).thenReturn("-q version"); subject.messageReceived(contextMock, messageEventMock); verify(channelMock).write(argThat(instanceofString())); verify(channelMock).write("% nrtm-server-" + VERSION + "\n\n"); } | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test(expected = NoSuchElementException.class) public void test_empty_next() { ProxyLoader<Integer, String> proxyLoader = Mockito.mock(ProxyLoader.class); subject = new ProxyIterable<>(Collections.<Integer>emptyList(), proxyLoader, 1); subject.iterator().next(); } | @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.hasNext(); } @Override public R next() { if (idx == b... | 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.hasNext(); } @... | 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.hasNext(); } @... | 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.hasNext(); } @... | 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.hasNext(); } @... |
@Test public void qFlagSourcesArgument() { when(messageEventMock.getMessage()).thenReturn("-q sources"); subject.messageReceived(contextMock, messageEventMock); verify(channelMock).write(argThat(instanceofString())); verify(channelMock).write(SOURCE + ":3:X:1-2\n\n"); } | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void gFlagValidRange() { when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-2"); subject.messageReceived(contextMock, messageEventMock); verify(channelMock, times(4)).write(argThat(instanceofString())); verify(channelMock).write("%START Version: 3 RIPE 1-2\n\n"); verify(channelMock).write("ADD 1\n... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void keepalive() { when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-LAST -k"); subject.messageReceived(contextMock, messageEventMock); verify(channelMock, times(3)).write(argThat(instanceofString())); verify(channelMock).write("%START Version: 3 RIPE 1-2\n\n"); verify(mySchedulerMock).scheduleAt... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void keepaliveEndOfStreamIndicator() { subject = new NrtmQueryHandler(serialDaoMock, dummifierMock, mySchedulerMock, nrtmLogMock, applicationVersion, SOURCE, NONAUTH_SOURCE, UPDATE_INTERVAL, true); when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-LAST -k"); subject.messageReceived(contextMock, m... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void gFlagValidRangeToLast() { when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-LAST"); subject.messageReceived(contextMock, messageEventMock); verify(channelMock, times(4)).write(argThat(instanceofString())); verify(channelMock).write("%START Version: 3 RIPE 1-2\n\n"); verify(channelMock).write... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void gFlag_InvalidRange() { when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:4-5"); try { subject.messageReceived(contextMock, messageEventMock); fail("Didn't catch IllegalArgumentException"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), containsString("%ERROR:401: invalid ran... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void closedChannel() { when(channelMock.isOpen()).thenReturn(false); when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-2"); try { subject.messageReceived(contextMock, messageEventMock); fail("expected ChannelException"); } catch (ChannelException expected) { verify(channelMock, atLeast(1)).isOpen... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void gFlagRequestOutOfDateSerial() { when(serialDaoMock.getAgeOfExactOrNextExistingSerial(1)).thenReturn(NrtmQueryHandler.HISTORY_AGE_LIMIT + 1); when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-2"); try { subject.messageReceived(contextMock, messageEventMock); fail("expected IllegalArgumentExce... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void gFlagDeprecatedVersion() { when(messageEventMock.getMessage()).thenReturn("-g RIPE:2:1-1"); subject.messageReceived(contextMock, messageEventMock); verify(channelMock, times(3)).write(argThat(instanceofString())); verify(channelMock).write("%START Version: 2 RIPE 1-1\n\n"); verify(channelMock).write("... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void channelConnected() throws Exception { subject.channelConnected(contextMock, channelStateEventMock); verify(channelMock).write(NrtmMessages.termsAndConditions() + "\n\n"); } | @Override public void channelConnected(final ChannelHandlerContext ctx, final ChannelStateEvent e) throws Exception { PendingWrites.add(ctx.getChannel()); writeMessage(ctx.getChannel(), NrtmMessages.termsAndConditions()); super.channelConnected(ctx, e); } | 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, e); } } | 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, e); } NrtmQuer... | 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, e); } NrtmQuer... | 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, e); } NrtmQuer... |
@Test public void test_load_empty() { ProxyLoader<Integer, String> proxyLoader = Mockito.mock(ProxyLoader.class); subject = new ProxyIterable<>(Arrays.asList(1, 2, 3), proxyLoader, 1); final Iterator<String> iterator = subject.iterator(); assertTrue(iterator.hasNext()); assertNull(iterator.next()); } | @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.hasNext(); } @Override public R next() { if (idx == b... | 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.hasNext(); } @... | 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.hasNext(); } @... | 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.hasNext(); } @... | 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.hasNext(); } @... |
@Test public void throttleChannelKeepaliveQuery() { setPending(channelMock); when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-LAST -k"); messageReceived(); unsetPending(channelMock); verify(channelMock).write("%START Version: 3 RIPE 1-2\n\n"); verify(channelMock, atMost(1)).write(any(String.class)); verify(m... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void retryForAnnotation() { when(serialDaoMock.getByIdForNrtm(any(Integer.class))).thenThrow(CannotGetJdbcConnectionException.class); when(messageEventMock.getMessage()).thenReturn("-g RIPE:3:1-LAST"); try { subject.messageReceived(contextMock, messageEventMock); fail(); } catch (CannotGetJdbcConnectionExc... | @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOGGER.debug("Received query: {}", queryString); final Quer... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... | NrtmQueryHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) { if (isKeepAlive()) { return; } final String queryString = e.getMessage().toString().trim(); nrtmLog.log(ChannelUtil.getRemoteAddress(ctx.getChannel()), queryString); LOG... |
@Test public void handle_illegal_argument_exception() { when(exceptionEventMock.getCause()).thenReturn(new IllegalArgumentException(QUERY)); subject.exceptionCaught(channelHandlerContextMock, exceptionEventMock); verify(channelMock, times(1)).write(QUERY + "\n\n"); verify(channelFutureMock, times(1)).addListener(Channe... | @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 instanceof IllegalArgumentException) { channel.write(exception.getMessage() + "\... | 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 instanceof IllegalAr... | 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 instanceof IllegalAr... | 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 instanceof IllegalAr... | 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 instanceof IllegalAr... |
@Test public void handle_exception() { when(exceptionEventMock.getCause()).thenReturn(new Exception()); subject.exceptionCaught(channelHandlerContextMock, exceptionEventMock); verify(channelMock, times(1)).write(NrtmExceptionHandler.MESSAGE); verify(channelFutureMock, times(1)).addListener(ChannelFutureListener.CLOSE);... | @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 instanceof IllegalArgumentException) { channel.write(exception.getMessage() + "\... | 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 instanceof IllegalAr... | 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 instanceof IllegalAr... | 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 instanceof IllegalAr... | 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 instanceof IllegalAr... |
@Test public void uniqueResult_no_results() { final Object result = CollectionHelper.uniqueResult(Arrays.asList()); assertNull(result); } | 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()); } } | 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()); } } } | 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(); } | 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 uniqueResult(final Col... | 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 uniqueResult(final Col... |
@Test public void uniqueResult_single_result() { final Integer result = CollectionHelper.uniqueResult(Arrays.asList(1)); assertThat(result, is(1)); } | 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()); } } | 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()); } } } | 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(); } | 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 uniqueResult(final Col... | 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 uniqueResult(final Col... |
@Test public void grsImport_RIPE_GRS_no_rebuild() throws Exception { await(subject.grsImport("RIPE-GRS", false)); verify(grsSourceImporter).grsImport(grsSourceRipe, false); verify(grsSourceImporter, never()).grsImport(grsSourceOther, false); } | public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for (final CIString enabledSource : sourcesToIm... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... |
@Test(expected = IllegalStateException.class) public void uniqueResult_multiple_results() { CollectionHelper.uniqueResult(Arrays.asList(1, 2)); } | 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()); } } | 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()); } } } | 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(); } | 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 uniqueResult(final Col... | 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 uniqueResult(final Col... |
@Test public void iterateProxy_empty() { ProxyLoader<Identifiable, RpslObject> proxyLoader = Mockito.mock(ProxyLoader.class); final Iterable<ResponseObject> responseObjects = CollectionHelper.iterateProxy(proxyLoader, Collections.<Identifiable>emptyList()); verify(proxyLoader, never()).load(anyListOf(Identifiable.class... | public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiables, rpslObjectLoade... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... |
@Test public void iterateProxy() { final RpslObjectInfo info1 = new RpslObjectInfo(1, ObjectType.INETNUM, "1"); final RpslObject object1 = RpslObject.parse("inetnum: 10.0.0.0"); final RpslObjectInfo info2 = new RpslObjectInfo(2, ObjectType.INETNUM, "2"); final RpslObject object2 = RpslObject.parse("inetnum: 10.0.0.1");... | public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiables, rpslObjectLoade... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... | CollectionHelper { public static Iterable<ResponseObject> iterateProxy( final ProxyLoader<Identifiable, RpslObject> rpslObjectLoader, final Iterable<? extends Identifiable> identifiables) { final ProxyIterable<Identifiable, ? extends ResponseObject> rpslObjects = new ProxyIterable<>((Iterable<Identifiable>) identifiabl... |
@Test public void undeleteObject_success() { when(updateDao.undeleteObject(1)).thenReturn(new RpslObjectUpdateInfo(1, 1, ObjectType.MNTNER, "DEV-MNT")); final String response = subject.undeleteObject(1, "comment"); assertThat(response, is( "Recovered object: RpslObjectUpdateInfo{objectId=1, objectType=MNTNER, key=DEV-M... | @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment", description = "Optional comment for in... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... |
@Test public void undeleteObject_error() { when(updateDao.undeleteObject(1)).thenThrow(EmptyResultDataAccessException.class); final String response = subject.undeleteObject(1, "comment"); assertThat(response, is("Unable to recover: null")); } | @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment", description = "Optional comment for in... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... | DatabaseMaintenanceJmx extends JmxBase { @ManagedOperation(description = "Recovers a deleted object (you will need to issue an IP tree rebuild if needed)") @ManagedOperationParameters({ @ManagedOperationParameter(name = "objectId", description = "Id of the object to recover"), @ManagedOperationParameter(name = "comment... |
@Test public void sanityCheckKickingIn() { for (String dbName : ImmutableList.of("WHOIS_UPDATE_RIPE", "MAILUPDATES")) { try { when(whoisTemplate.queryForObject("SELECT database()", String.class)).thenReturn(dbName); JdbcRpslObjectOperations.sanityCheck(whoisTemplate); fail("Database name '" + dbName + "' did not trigge... | public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s has no 'test' or 'grs' in th... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... |
@Test public void sanityCheckLettingThrough() { when(whoisTemplate.queryForObject(startsWith("SELECT count(*) FROM "), eq(Integer.class))).thenReturn(10); for (String dbName : ImmutableList.of("WHOIS_TEST_TEST", "GRSteST", "WHOIS_MIRROR_APNIC_GRS")) { when(whoisTemplate.queryForObject(eq("SELECT database()"), eq(String... | public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s has no 'test' or 'grs' in th... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... | JdbcRpslObjectOperations { public static void sanityCheck(final JdbcTemplate jdbcTemplate) { try { final String dbName = jdbcTemplate.queryForObject("SELECT database()", String.class); if (!dbName.matches("(?i).*_mirror_.+_grs.*") && !dbName.matches("(?i).*test.*")) { throw new IllegalStateException(String.format("%s h... |
@Test public void getAttributeType() { assertThat(subject.getAttributeType(), is(ATTRIBUTE_TYPE)); } | @Override public final AttributeType getAttributeType() { return attributeType; } | IndexStrategyAdapter implements IndexStrategy { @Override public final AttributeType getAttributeType() { return attributeType; } } | IndexStrategyAdapter implements IndexStrategy { @Override public final AttributeType getAttributeType() { return attributeType; } IndexStrategyAdapter(final AttributeType attributeType); } | 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 RpslObjectInf... | 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 RpslObjectInf... |
@Test public void addToIndex() { assertThat(subject.addToIndex(null, null, null, (String) null), is(1)); } | @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 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 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 AttributeType attri... | 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 AttributeType attri... | 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 AttributeType attri... |
@Test public void findInIndex() { assertThat(subject.findInIndex(null, (String) null), hasSize(0)); assertThat(subject.findInIndex(null, new RpslObjectInfo(1, ObjectType.AUT_NUM, "AS000")), hasSize(0)); assertThat(subject.findInIndex(null, new RpslObjectInfo(1, ObjectType.AUT_NUM, "AS000"), ObjectType.AUT_NUM), hasSize... | @Override public final List<RpslObjectInfo> findInIndex(final JdbcTemplate jdbcTemplate, final CIString value) { return findInIndex(jdbcTemplate, value.toString()); } | IndexStrategyAdapter implements IndexStrategy { @Override public final List<RpslObjectInfo> findInIndex(final JdbcTemplate jdbcTemplate, final CIString value) { return findInIndex(jdbcTemplate, value.toString()); } } | IndexStrategyAdapter implements IndexStrategy { @Override public final List<RpslObjectInfo> findInIndex(final JdbcTemplate jdbcTemplate, final CIString value) { return findInIndex(jdbcTemplate, value.toString()); } IndexStrategyAdapter(final AttributeType attributeType); } | 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 getAttributeType()... | 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 getAttributeType()... |
@Test public void grsImport_RIPE_GRS_rebuild() throws Exception { await(subject.grsImport("RIPE-GRS", true)); verify(grsSourceImporter).grsImport(grsSourceRipe, true); verify(grsSourceImporter, never()).grsImport(grsSourceOther, true); } | public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for (final CIString enabledSource : sourcesToIm... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... |
@Test public void removeFromIndex() { subject.removeFromIndex(null, null); } | @Override public void removeFromIndex(final JdbcTemplate jdbcTemplate, final RpslObjectInfo objectInfo) { } | IndexStrategyAdapter implements IndexStrategy { @Override public void removeFromIndex(final JdbcTemplate jdbcTemplate, final RpslObjectInfo objectInfo) { } } | IndexStrategyAdapter implements IndexStrategy { @Override public void removeFromIndex(final JdbcTemplate jdbcTemplate, final RpslObjectInfo objectInfo) { } IndexStrategyAdapter(final AttributeType attributeType); } | 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 JdbcTemplate jdbcTem... | 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 JdbcTemplate jdbcTem... |
@Test public void getLookupTableName() { assertNull(subject.getLookupTableName()); } | @Override public String getLookupTableName() { return null; } | IndexStrategyAdapter implements IndexStrategy { @Override public String getLookupTableName() { return null; } } | IndexStrategyAdapter implements IndexStrategy { @Override public String getLookupTableName() { return null; } IndexStrategyAdapter(final AttributeType attributeType); } | 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 objectInfo, final ... | 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 objectInfo, final ... |
@Test public void getLookupColumnName() { assertNull(subject.getLookupColumnName()); } | @Override public String getLookupColumnName() { return null; } | IndexStrategyAdapter implements IndexStrategy { @Override public String getLookupColumnName() { return null; } } | IndexStrategyAdapter implements IndexStrategy { @Override public String getLookupColumnName() { return null; } IndexStrategyAdapter(final AttributeType attributeType); } | 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 objectInfo, final... | 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 objectInfo, final... |
@Test public void check_index_strategied_for_lookup_attributes() { final Set<AttributeType> attibutesWithrequiredIndex = Sets.newHashSet(); for (final ObjectType objectType : ObjectType.values()) { final ObjectTemplate objectTemplate = ObjectTemplate.getTemplate(objectType); attibutesWithrequiredIndex.addAll(objectTemp... | public static IndexStrategy get(final AttributeType attributeType) { return INDEX_BY_ATTRIBUTE.get(attributeType); } | IndexStrategies { public static IndexStrategy get(final AttributeType attributeType) { return INDEX_BY_ATTRIBUTE.get(attributeType); } } | IndexStrategies { public static IndexStrategy get(final AttributeType attributeType) { return INDEX_BY_ATTRIBUTE.get(attributeType); } private IndexStrategies(); } | 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); } | 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); } |
@Test public void getBySerialType() { for (Integer objectTypeId : ImmutableList.of(0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)) { assertThat(ObjectTypeIds.getType(objectTypeId), Matchers.instanceOf(ObjectType.class)); } } | 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; } | 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; } } | 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; } private O... | 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; } private O... | 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; } private O... |
@Test(expected = IllegalArgumentException.class) public void getBySerialType_unknown() { ObjectTypeIds.getType(-1000); } | 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; } | 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; } } | 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; } private O... | 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; } private O... | 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; } private O... |
@Test public void test_getConnection() throws Exception { subject.getConnection(); verify(dataSource, times(1)).getConnection(); } | @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } } | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } @Autowired SourceAwareDataSource(final BasicSourceContext sourceContext); } | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } @Autowired SourceAwareDataSource(final BasicSourceContext sourceContext); @Override Connection getConnection(); @Override Connection getConnection(final S... | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } @Autowired SourceAwareDataSource(final BasicSourceContext sourceContext); @Override Connection getConnection(); @Override Connection getConnection(final S... |
@Test public void test_getConnection_with_user() throws Exception { subject.getConnection("username", "password"); verify(dataSource, times(1)).getConnection("username", "password"); } | @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } } | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } @Autowired SourceAwareDataSource(final BasicSourceContext sourceContext); } | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } @Autowired SourceAwareDataSource(final BasicSourceContext sourceContext); @Override Connection getConnection(); @Override Connection getConnection(final S... | SourceAwareDataSource extends AbstractDataSource { @Override public Connection getConnection() throws SQLException { return getActualDataSource().getConnection(); } @Autowired SourceAwareDataSource(final BasicSourceContext sourceContext); @Override Connection getConnection(); @Override Connection getConnection(final S... |
@Test public void testVersionNumberCheck() { assertThat(DatabaseVersionCheck.compareVersions("1.0", "2.0"), lessThan(0)); assertThat(DatabaseVersionCheck.compareVersions("1.1", "2.0"), lessThan(0)); assertThat(DatabaseVersionCheck.compareVersions("1.01", "2.0"), lessThan(0)); assertThat(DatabaseVersionCheck.compareVers... | public static int compareVersions(final String v1, final String v2) { Iterator<String> i1 = VERSION_SPLITTER.split(v1).iterator(); Iterator<String> i2 = VERSION_SPLITTER.split(v2).iterator(); while (i1.hasNext() && i2.hasNext()) { int res = Integer.parseInt(i1.next()) - Integer.parseInt(i2.next()); if (res != 0) { retu... | DatabaseVersionCheck { public static int compareVersions(final String v1, final String v2) { Iterator<String> i1 = VERSION_SPLITTER.split(v1).iterator(); Iterator<String> i2 = VERSION_SPLITTER.split(v2).iterator(); while (i1.hasNext() && i2.hasNext()) { int res = Integer.parseInt(i1.next()) - Integer.parseInt(i2.next()... | DatabaseVersionCheck { public static int compareVersions(final String v1, final String v2) { Iterator<String> i1 = VERSION_SPLITTER.split(v1).iterator(); Iterator<String> i2 = VERSION_SPLITTER.split(v2).iterator(); while (i1.hasNext() && i2.hasNext()) { int res = Integer.parseInt(i1.next()) - Integer.parseInt(i2.next()... | DatabaseVersionCheck { public static int compareVersions(final String v1, final String v2) { Iterator<String> i1 = VERSION_SPLITTER.split(v1).iterator(); Iterator<String> i2 = VERSION_SPLITTER.split(v2).iterator(); while (i1.hasNext() && i2.hasNext()) { int res = Integer.parseInt(i1.next()) - Integer.parseInt(i2.next()... | DatabaseVersionCheck { public static int compareVersions(final String v1, final String v2) { Iterator<String> i1 = VERSION_SPLITTER.split(v1).iterator(); Iterator<String> i2 = VERSION_SPLITTER.split(v2).iterator(); while (i1.hasNext() && i2.hasNext()) { int res = Integer.parseInt(i1.next()) - Integer.parseInt(i2.next()... |
@Test public void testCheckDatabaseOK() { DatabaseVersionCheck subject = new DatabaseVersionCheck(null); subject.checkDatabase(ImmutableList.of("whois-1.51", "whois-1.4", "whois-2.15.4"), "TEST", "whois-2.16"); } | public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : resources) { final Matcher ... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... |
@Test public void grsImport_unknown_source() throws Exception { await(subject.grsImport("UNKNOWN-GRS", true)); verify(grsSourceRipe, never()).acquireDump(any(Path.class)); verify(grsSourceRipe, never()).handleObjects(any(File.class), any(ObjectHandler.class)); verify(grsDao, never()).cleanDatabase(); } | public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for (final CIString enabledSource : sourcesToIm... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... |
@Test(expected = IllegalStateException.class) public void testCheckDatabaseFail() { DatabaseVersionCheck subject = new DatabaseVersionCheck(null); subject.checkDatabase(ImmutableList.of("whois-1.51", "whois-1.4", "whois-2.15.4"), "TEST", "whois-1.16"); } | public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : resources) { final Matcher ... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... |
@Test public void testCheckDatabaseSucceedForAnotherDB() { DatabaseVersionCheck subject = new DatabaseVersionCheck(null); subject.checkDatabase(ImmutableList.of("scheduler-1.51", "whois-1.4", "acl-2.15.4"), "TEST", "whois-1.16"); } | public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : resources) { final Matcher ... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... | DatabaseVersionCheck { public void checkDatabase(Iterable<String> resources, String dataSourceName, String dbVersion) { final Matcher dbVersionMatcher = RESOURCE_MATCHER.matcher(dbVersion); if (!dbVersionMatcher.matches()) { throw new IllegalStateException("Invalid version: " + dbVersion); } for (String resource : reso... |
@Test public void fromDate() { assertThat(DateUtil.fromDate(new Date(EPOCH_TIMESTAMP)), is(EPOCH_LOCAL_DATE_TIME)); assertThat(DateUtil.fromDate(new Date(RECENT_TIMESTAMP)), is(RECENT_LOCAL_DATE_TIME)); } | public static LocalDateTime fromDate(final Date date) { return Instant.ofEpochMilli(date.getTime()) .atZone(ZoneOffset.systemDefault()) .toLocalDateTime(); } | DateUtil { public static LocalDateTime fromDate(final Date date) { return Instant.ofEpochMilli(date.getTime()) .atZone(ZoneOffset.systemDefault()) .toLocalDateTime(); } } | DateUtil { public static LocalDateTime fromDate(final Date date) { return Instant.ofEpochMilli(date.getTime()) .atZone(ZoneOffset.systemDefault()) .toLocalDateTime(); } private DateUtil(); } | 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 LocalDateTime fromDat... | 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 LocalDateTime fromDat... |
@Test public void toDate() { assertThat(DateUtil.toDate(EPOCH_LOCAL_DATE_TIME), is(new Date(EPOCH_TIMESTAMP))); assertThat(DateUtil.toDate(RECENT_LOCAL_DATE_TIME), is(new Date(RECENT_TIMESTAMP))); } | public static Date toDate(final LocalDateTime localDateTime) { return Date.from(localDateTime.atZone(ZoneOffset.systemDefault()) .toInstant()); } | DateUtil { public static Date toDate(final LocalDateTime localDateTime) { return Date.from(localDateTime.atZone(ZoneOffset.systemDefault()) .toInstant()); } } | DateUtil { public static Date toDate(final LocalDateTime localDateTime) { return Date.from(localDateTime.atZone(ZoneOffset.systemDefault()) .toInstant()); } private DateUtil(); } | 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 fromDate(final Date... | 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 fromDate(final Date... |
@Test public void equals() { final BlockEvent subject = new BlockEvent(LocalDateTime.of(2012, 2, 16, 12, 0), 1, BlockEvent.Type.BLOCK_TEMPORARY); final BlockEvent clone = new BlockEvent(LocalDateTime.of(2012, 2, 16, 12, 0), 1, BlockEvent.Type.BLOCK_TEMPORARY); final BlockEvent newDate = new BlockEvent(LocalDateTime.of(... | @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 { @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 { @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 int limit, final... | 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 int limit, final... | 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 int limit, final... |
@Test(expected = NullPointerException.class) public void test_events_null() { final BlockEvents blockEvents = new BlockEvents(prefix, null); blockEvents.getTemporaryBlockCount(); } | public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected block event typ... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... |
@Test public void test_number_of_blocks() { final BlockEvents blockEvents = createBlockEvents("10.0.0.0", 3); assertThat(blockEvents.getTemporaryBlockCount(), is(3)); } | public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected block event typ... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... |
@Test public void test_number_of_blocks_after_unblock() { final List<BlockEvent> events = Arrays.asList( createBlockEvent(1, BlockEvent.Type.BLOCK_TEMPORARY), createBlockEvent(2, BlockEvent.Type.BLOCK_TEMPORARY), createBlockEvent(3, BlockEvent.Type.BLOCK_TEMPORARY), createBlockEvent(4, BlockEvent.Type.UNBLOCK), createB... | public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected block event typ... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... |
@Test public void test_number_of_blocks_after_unblock_unspecified_order() { final List<BlockEvent> events = Arrays.asList( createBlockEvent(4, BlockEvent.Type.UNBLOCK), createBlockEvent(5, BlockEvent.Type.BLOCK_TEMPORARY), createBlockEvent(3, BlockEvent.Type.BLOCK_TEMPORARY), createBlockEvent(2, BlockEvent.Type.BLOCK_T... | public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected block event typ... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... | BlockEvents { public int getTemporaryBlockCount() { int numberOfBlocks = 0; for (final BlockEvent blockEvent : blockEvents) { switch (blockEvent.getType()) { case BLOCK_TEMPORARY: numberOfBlocks++; break; case UNBLOCK: case BLOCK_PERMANENTLY: return numberOfBlocks; default: throw new IllegalStateException("Unexpected b... |
@Test public void test_permanent_block_limit_reached_9() { final BlockEvents blockEvents = createBlockEvents(prefix, 9); assertThat(blockEvents.isPermanentBlockRequired(), is(false)); } | public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } | BlockEvents { public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } } | BlockEvents { public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } BlockEvents(final String prefix, final List<BlockEvent> blockEvents); } | 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(); } | 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_TEMP_BLOCKS_BEFO... |
@Test public void grsImport_RIPE_GRS_acquire_fails() throws Exception { doThrow(RuntimeException.class).when(grsSourceRipe).acquireDump(any(Path.class)); await(subject.grsImport("RIPE-GRS", false)); verify(grsSourceRipe, never()).handleObjects(any(File.class), any(ObjectHandler.class)); } | public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for (final CIString enabledSource : sourcesToIm... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... | GrsImporter implements DailyScheduledTask { public List<Future> grsImport(String sources, final boolean rebuild) { final Set<CIString> sourcesToImport = splitSources(sources); LOGGER.info("GRS import sources: {}", sourcesToImport); final List<Future> futures = Lists.newArrayListWithCapacity(sourcesToImport.size()); for... |
@Test public void test_permanent_block_limit_reached_10() { final BlockEvents blockEvents = createBlockEvents(prefix, 10); assertThat(blockEvents.isPermanentBlockRequired(), is(true)); } | public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } | BlockEvents { public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } } | BlockEvents { public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } BlockEvents(final String prefix, final List<BlockEvent> blockEvents); } | 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(); } | 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_TEMP_BLOCKS_BEFO... |
@Test public void test_permanent_block_limit_reached_50() { final BlockEvents blockEvents = createBlockEvents(prefix, 50); assertThat(blockEvents.isPermanentBlockRequired(), is(true)); } | public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } | BlockEvents { public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } } | BlockEvents { public boolean isPermanentBlockRequired() { return getTemporaryBlockCount() >= NR_TEMP_BLOCKS_BEFORE_PERMANENT; } BlockEvents(final String prefix, final List<BlockEvent> blockEvents); } | 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(); } | 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_TEMP_BLOCKS_BEFO... |
@Test public void set_and_unset_state() { Counter counter = new Counter(); new Thread(counter).start(); subject.set(true); waitForExpectedValue(counter, 1); subject.set(false); subject.set(false); subject.set(false); waitForExpectedValue(counter, 2); subject.set(true); waitForExpectedValue(counter, 3); } | public void set(final Boolean value) { updates.add(value); } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } void set(final Boolean value); void waitUntil(final Boolean value); } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } void set(final Boolean value); void waitUntil(final Boolean value); } |
@Test public void set_and_unset_state_multiple_updates() { subject.set(true); subject.set(false); subject.set(false); subject.set(false); subject.set(true); Counter counter = new Counter(); new Thread(counter).start(); waitForExpectedValue(counter, 1); } | public void set(final Boolean value) { updates.add(value); } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } void set(final Boolean value); void waitUntil(final Boolean value); } | ConcurrentState { public void set(final Boolean value) { updates.add(value); } void set(final Boolean value); void waitUntil(final Boolean value); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.