public void testContextIsNotOrphanWhenUpdatingNonRoot() throws Exception { addLocalPageWithImportProperty(localRoot, "PageOne", false); importer.parseUrl("http://localhost:" + FitNesseUtil.port + "/PageOne"); importer.importWiki(localRoot.getChildPage("PageOne")); assertEquals(0, importer.getOrphans().size()); }
public void testParsingBadUrl() throws Exception { try { importer.parseUrl("blah"); fail("should have exception"); } catch (Exception e) { assertEquals("blah is not a valid URL.", e.getMessage()); } }
public void testParsingUrlWithNonWikiWord() throws Exception { try { importer.parseUrl("http://blah.com/notawikiword"); fail("should throw exception"); } catch (Exception e) { assertEquals( "The URL's resource path, notawikiword, is not a valid WikiWord.", e.getMessage()); } }
public void setUp() throws Exception { createRemoteRoot(); createLocalRoot(); FitNesseUtil.startFitnesse(remoteRoot); importer = new WikiImporter(); importer.setWikiImporterClient(this); importer.parseUrl("http://localhost:" + FitNesseUtil.port); imports = new LinkedList<WikiPage>(); errors = new LinkedList<Exception>(); }
public void testAutoUpdatePropertySetOnRoot() throws Exception { addLocalPageWithImportProperty(localRoot, "PageOne", false); importer.parseUrl("http://localhost:" + FitNesseUtil.port + "/PageOne"); importer.setAutoUpdateSetting(true); WikiPage importedPage = localRoot.getChildPage("PageOne"); importer.importWiki(importedPage); WikiImportProperty importProp = WikiImportProperty.createFrom(importedPage.getData().getProperties()); assertTrue(importProp.isAutoUpdate()); importer.setAutoUpdateSetting(false); importer.importWiki(importedPage); importProp = WikiImportProperty.createFrom(importedPage.getData().getProperties()); assertFalse(importProp.isAutoUpdate()); }
public void run(TestResponder testResponder, PageData data) throws Exception { this.testResponder = testResponder; this.data = data; importProperty = WikiImportProperty.createFrom(data.getProperties()); if (importProperty != null && importProperty.isAutoUpdate()) { testResponder.addToResponse("<span class=\"meta\">Updating imported content...</span>"); testResponder.addToResponse("<span class=\"meta\">"); try { wikiImporter = importerFactory.newImporter(this); wikiImporter.parseUrl(importProperty.getSourceUrl()); wikiPage = data.getWikiPage(); doUpdating(); if (!errorOccured) testResponder.addToResponse("done"); } catch (Exception e) { pageImportError(data.getWikiPage(), e); } testResponder.addToResponse("</span>"); } }
private void testUrlParsing(String url, String host, int port, String path) throws Exception { importer.parseUrl(url); assertEquals(host, importer.getRemoteHostname()); assertEquals(port, importer.getRemotePort()); assertEquals(path, PathParser.render(importer.getRemotePath())); }