public void testConvert_NoRefOtherPage()

in src/main/java/com/atlassian/uwc/converters/jspwiki/ImageConverterTest.java [1543:1631]


	public void testConvert_NoRefOtherPage() {
		String name = "SampleJspwiki-Input21.txt";
		//get file contents
		String input = "an attachment: [SampleJspwiki-Input21/ed.jpeg]\n" + 
				"not an image: [SampleJspwiki-Input21/ed.zip]\n" + 
				"\n" + 
				"with an alias: [alias|SampleJspwiki-Input21/ed.png]\n" + 
				"with an alias: [alias|SampleJspwiki-Input21/ed.doc]\n" +
				//see uwc-346
				"with spaces: [a link to another page attachment|awikipage/a wiki attachment.xls].\n" +
				"[a link to another page attachment|awikipage/a+wiki+attachment.xls]\n" +
				"[otherpage/a+wiki+attachment.png]\n" +
				"[otherpage/a wiki attachment.png]\n" +
				"[SampleJspwiki-Input22/foo+bar.jpg]\n" +
				//see http://developer.atlassian.com/jira/browse/UWC-335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=25532#action_25532
				"[a.link.to.an.attachment|awikipage/a+wiki+attachment.xls]\n"; 
		//set attachment directory
		tester.setAttachmentDirectory("sampleData/jspwiki/");
		//without all pages
		Page page = new Page(null);
		page.setOriginalText(input);
		page.setName(name);
		Properties properties = tester.getProperties();
		tester.setProperties(properties);
		properties.put("images-all", "false");
		tester.convert(page);
		String expected = "an attachment: !ed.jpeg!\n" + 
				"not an image: [^ed.zip]\n" + 
				"\n" + 
				"with an alias: !ed.png!\n" + 
				"with an alias: [alias|^ed.doc]\n" +
				"with spaces: [a link to another page attachment|awikipage^a wiki attachment.xls].\n" +
				"[a link to another page attachment|awikipage^a wiki attachment.xls]\n" +
				"!otherpage^a wiki attachment.png!\n" +
				"!otherpage^a wiki attachment.png!\n" +
				"!SampleJspwiki-Input22^foo bar.jpg!\n" +
				"[a.link.to.an.attachment|awikipage^a wiki attachment.xls]\n";
		assertNotNull(page.getConvertedText());
		assertEquals(expected, page.getConvertedText());
		
		//does page have attachments
		Set<File> actual = page.getAttachments();
		assertNotNull(actual);
		assertEquals(4, actual.size());
		File parent = null;
		for (Iterator iter = actual.iterator(); iter.hasNext();) {
			File file = (File) iter.next();
			assertTrue(file.getName(), file.exists());
			assertTrue(file.getName().equals("ed.zip") || 
					file.getName().equals("ed.jpeg") ||
					file.getName().equals("ed.png") ||
					file.getName().equals("ed.doc")
					);
			parent = file.getParentFile();
			file.delete(); //clean up unit test
		}
		
		
		//with all pages
		page = new Page(null);
		page.setOriginalText(input);
		page.setName(name);
		properties.put("images-all", "true");
		tester.convert(page);
		assertNotNull(page.getConvertedText());
		assertEquals(expected, page.getConvertedText());
		
		//does page have attachments
		actual = null;
		actual = page.getAttachments();
		assertNotNull(actual);
		assertEquals(4, actual.size());
		parent = null;
		for (Iterator iter = actual.iterator(); iter.hasNext();) {
			File file = (File) iter.next();
			assertTrue(file.getName(), file.exists());
			assertTrue(file.getName().equals("ed.zip") || 
					file.getName().equals("ed.jpeg") ||
					file.getName().equals("ed.png") ||
					file.getName().equals("ed.doc")
					);
			parent = file.getParentFile();
			file.delete(); //clean up unit test
		}
		
		parent.delete();//clean up unit test


	}