HtmlAddonResource extends Resource { @Override public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(this.alteredContent); } HtmlAddonResource(final Resource indexResource, final String bodyAddon, final String headAddon); @Override File getFile(); @Override InputStream getInputStream(); @Override String getName(); @Override boolean isContainedIn(Resource r); @Override boolean exists(); @Override boolean isDirectory(); @Override long lastModified(); @Override long length(); @Override URL getURL(); @Override ReadableByteChannel getReadableByteChannel(); @Override boolean delete(); @Override boolean renameTo(Resource dest); @Override String[] list(); @Override Resource addPath(String path); @Override void close(); static final String HTML_ADDON_IDENTIFIER; static final String INDEX_HTML_PATH; }
@Test public void testZeppelinWebHtmlAddon() throws IOException { final Resource addonResource = getHtmlAddonResource(FILE_PATH_INDEX_HTML_ZEPPELIN_WEB); final String content; try (final Reader reader = new InputStreamReader(addonResource.getInputStream())) { content = CharStreams.toString(reader); } assertThat(content, containsString(TEST_BODY_ADDON)); assertThat(content, containsString(TEST_HEAD_ADDON)); }
@Test @Ignore public void testZeppelinWebAngularHtmlAddon() throws IOException { final Resource addonResource = getHtmlAddonResource(FILE_PATH_INDEX_HTML_ZEPPELIN_WEB_ANGULAR); final String content; try (final Reader reader = new InputStreamReader(addonResource.getInputStream())) { content = CharStreams.toString(reader); } assertThat(content, containsString(TEST_BODY_ADDON)); assertThat(content, containsString(TEST_HEAD_ADDON)); }