@VisibleForTesting public static Set<String> getAddressBooks(ReferenceLibrary referenceLibrary) { ImmutableSet.Builder<String> addressBooks = ImmutableSet.builder(); referenceLibrary.getReferenceBooks().stream() .map(ReferenceBook::getName) .forEach(addressBooks::add); return addressBooks.build(); }
public ReferenceLibraryBean(ReferenceLibrary library) { books = library.getReferenceBooks().stream() .map(book -> new ReferenceBookBean(book)) .collect(Collectors.toSet()); }
@VisibleForTesting public static Set<String> getAddressGroups(ReferenceLibrary referenceLibrary) { ImmutableSet.Builder<String> addressGroups = ImmutableSet.builder(); referenceLibrary .getReferenceBooks() .forEach( referenceBook -> referenceBook.getAddressGroups().stream() .map(AddressGroup::getName) .forEach(addressGroups::add)); return addressGroups.build(); }
/** check that we deserialize successfully and into two books */ @Test public void libraryDeserialization() throws IOException { ReferenceLibrary library = BatfishObjectMapper.mapper() .readValue( CommonUtil.readResource("org/batfish/referencelibrary/libraryTwoBooks.json"), ReferenceLibrary.class); assertThat(library.getReferenceBooks(), hasSize(2)); }
ReferenceLibrary testrigData = ReferenceLibrary.read(subFile); Path path = networkDir.resolve(BfConsts.RELPATH_REFERENCE_LIBRARY_PATH); ReferenceLibrary.mergeReferenceBooks(path, testrigData.getReferenceBooks()); } catch (IOException e) {
ReferenceLibrary.read(tempPath).getReferenceBooks(), equalTo( ImmutableSortedSet.of(