JSwordPassageServiceImpl implements JSwordPassageService { @Override public OsisWrapper getOsisText(final String version, final String reference) { return getOsisText(version, reference, new ArrayList<LookupOption>(0), null, NONE); } @Inject  JSwordPassageServiceImpl(final JSwordVersificationService versificationService,
                                    final MorphologyServiceImpl morphologyProvider, final VocabularyService vocabProvider,
                                    final ColorCoderProviderImpl colorCoder, final VersionResolver resolver,
                                    final PassageOptionsValidationService optionsValidationService); @Override KeyWrapper getSiblingChapter(final String reference, final String version,
                                        final boolean previousChapter); @Override KeyWrapper getKeyInfo(final String reference, final String sourceVersion, String version); @Override KeyWrapper expandToChapter(final String version, final String reference); @Override String getPlainText(final String version, final String reference, final boolean firstVerse); @Override Key getFirstVerseExcludingZero(final Key key, final Book b); @Override Key getFirstVersesFromRange(final Key range, final int context); @Override OsisWrapper peakOsisText(final Book bible, final Key key, final List<LookupOption> options); @Override OsisWrapper peakOsisText(String[] versions, Key lookupKey, List<LookupOption> options, String interlinearMode); OsisWrapper getPassageByDisplayMode(List<String> versionsInput, Key reference, List<LookupOption> options, final String interlinearMode); @Override OsisWrapper getOsisText(final String version, final String reference); @Override OsisWrapper getOsisTextByVerseNumbers(final String version, final String numberedVersion,
                                                 final int startVerseId, final int endVerseId, final List<LookupOption> lookupOptions,
                                                 final String interlinearVersion, final Boolean roundReference, final boolean ignoreVerse0); @Override OsisWrapper getOsisText(final String version, final String reference,
                                   final List<LookupOption> options, final String interlinearVersion,
                                   final InterlinearMode displayMode); @Override OsisWrapper getInterleavedVersions(final String[] versions, final String reference,
                                              final List<LookupOption> options, final InterlinearMode displayMode); @Override String getAllReferences(final String references, final String version); @Override StringAndCount getAllReferencesAndCounts(final String references, final String version);  }
@Test public void testColorCoding() { final List<LookupOption> options = new ArrayList<LookupOption>(); options.add(LookupOption.COLOUR_CODE); final OsisWrapper osisText = this.jsi.getOsisText("KJV", "Gen.1.1", options, null, InterlinearMode.NONE); assertTrue(osisText.getValue().contains("In the beginning")); }
@Test public void testColorCodingInterlinear() { final List<LookupOption> options = new ArrayList<LookupOption>(); options.add(LookupOption.COLOUR_CODE); options.add(LookupOption.INTERLINEAR); final OsisWrapper osisText = this.jsi.getOsisText("KJV", "Gen.1.1", options, "KJV", InterlinearMode.INTERLINEAR); assertTrue(osisText.getValue().contains("In the beginning")); }
@Test public void readRev12FromNrsvEsv() { this.jsi.getOsisText("ESV_th", "Rev.12.17-18"); }
@Test public void testInterlinearTransformation() throws NoSuchKeyException, BookException, JDOMException, IOException { final Book currentBook = Books.installed().getBook("OSMHB"); final BookData bookData = new BookData(currentBook, currentBook.getKey("Ps.51")); final Element osisFragment = bookData.getOsisFragment(); final XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat()); LOGGER.trace(xmlOutputter.outputString(osisFragment)); final List<LookupOption> options = new ArrayList<LookupOption>(); final String osisText = this.jsi.getOsisText("OSMHB", "Ps.51", options, "ESV_th", InterlinearMode.INTERLINEAR).getValue(); final SAXBuilder sb = new SAXBuilder(); final Document d = sb.build(new StringReader(osisText)); LOGGER.trace("\n {}", xmlOutputter.outputString(d)); Assert.assertTrue(osisText.contains("span class='interlinear'")); }
@Test public void testXslTransformation() throws BookException, NoSuchKeyException, JDOMException, IOException { final Book currentBook = Books.installed().getBook("KJV"); final BookData bookData = new BookData(currentBook, currentBook.getKey("Romans 1:4")); final Element osisFragment = bookData.getOsisFragment(); final XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat()); LOGGER.trace(xmlOutputter.outputString(osisFragment)); final List<LookupOption> options = new ArrayList<LookupOption>(); final String osisText = this.jsi.getOsisText("KJV", "Romans 1:4", options, "", InterlinearMode.NONE) .getValue(); final SAXBuilder sb = new SAXBuilder(); final Document d = sb.build(new StringReader(osisText)); LOGGER.trace("\n {}", xmlOutputter.outputString(d)); Assert.assertTrue(osisText.contains("span")); }
@Test public void testSegVariants() throws BookException, NoSuchKeyException, JDOMException, IOException { final XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat()); final String ref = "Mat.9.4"; final String version = "WHNU"; final Book book = Books.installed().getBook(version); final BookData data = new BookData(book, book.getKey(ref)); LOGGER.info("Original is:\n {}", xmlOutputter.outputString(data.getOsisFragment())); final OsisWrapper interleavedVersions = this.jsi.getOsisText(version, ref); final SAXBuilder sb = new SAXBuilder(); final Document d = sb.build(new StringReader(interleavedVersions.getValue())); final String outputString = xmlOutputter.outputString(d); LOGGER.info(outputString); assertTrue(outputString.contains("ειδως")); assertTrue(outputString.contains("title=\"ιδων")); }
@Test public void testLongHeaders() throws BookException, NoSuchKeyException, JDOMException, IOException { final String version = "ESV_th"; final String ref = "Luk 4:27"; org.crosswire.jsword.versification.BookName.setFullBookName(false); final String osisText = this.jsi.getOsisText(version, ref, new ArrayList<LookupOption>(), null, InterlinearMode.NONE).getValue(); if (LOGGER.isDebugEnabled()) { final XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat()); final SAXBuilder sb = new SAXBuilder(); final Document d = sb.build(new StringReader(osisText)); LOGGER.debug("\n {}", xmlOutputter.outputString(d)); } Assert.assertTrue(osisText.contains("Luke 4:27")); }