@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_QUICKTIME; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_SWF; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_WMA; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_WMV; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_MP3; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_MP4; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_AVI; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
public Attachment pageViaRpc(String attachmentPath, String contentType, User remoteUser, Page page) { Attachment attachment = new Attachment(page, attachmentPath, contentType, "", Classpath.getBytes(attachmentPath)); rpc.logIn(remoteUser); rpc.createAttachment(attachment); return attachment; } }
public Attachment draftFromEditor(String attachmentPath, String contentType, User remoteUser, Space space) { String draftId = client.getEval("this.AJS.params.contentId"); // We just need to create a container Page draftPage = new Page(space, "", ""); draftPage.setId(Long.valueOf(draftId)); Attachment attachment = new Attachment(draftPage, attachmentPath, contentType, "", Classpath.getBytes(attachmentPath)); rpc.logIn(remoteUser); rpc.createAttachmentOnDraft(attachment); return attachment; }
private void runMediaAutoCompleteTest(String mediaFile) { Attachment attachment = new Attachment(testPage, mediaFile, Attachment.SWF_TYPE, "", Classpath.getBytes(mediaFile)); rpc.logIn(adminUser); rpc.createAttachment(attachment); rpc.flushIndexQueue(); testContent = attachment; searchText = mediaFile; editor.createPage(testSpace); autocompleteSearchAndSelect(); Map<String,String> expectedParameters = new HashMap<String,String>(3); expectedParameters.put("page", testPage.getTitle()); expectedParameters.put("name", mediaFile); expectedParameters.put("space", testSpace.getKey()); assertEquals("Expected macro placeholder not found.", expectedParameters, editor.getMacroParameters("multimedia")); }
public void testPptxAttachmentsListed() { // we don't care what's inside the file as long as it has pptx extension String attachmentName = "fence.pptx"; Attachment attachment = new Attachment(testPage, attachmentName, "application/ms-powerpoint" , "", Classpath.getBytes(TEST_PDF)); rpc.createAttachment(attachment); editor.logInAndEdit(adminUser, testPage); MacroBrowser mb = editor.openMacroBrowser(); mb.selectMacro("viewppt", false); waitUntilSelectBoxHasOption(mb, FILE_PARAM_NAME, attachmentName); }
public void testCommentHasAttachmentsListedForBlogPost() { Attachment attachment = new Attachment(testBlogPost, TEST_PDF, Attachment.PDF_TYPE, "", Classpath.getBytes(TEST_PDF)); rpc.createAttachment(attachment); editor.logInAndAddComment(User.ADMIN, testBlogPost); MacroBrowser mb = editor.openMacroBrowser(); mb.selectMacro("viewpdf", false); waitUntilSelectBoxHasOption(mb, FILE_PARAM_NAME, TEST_PDF); }
private void runAutocompleteForAttachmentOnBlogPost() { String pdfName = "blogstar.jpg"; Attachment attachment = new Attachment(testBlogPost, pdfName, Attachment.PNG_TYPE, "", Classpath.getBytes(testImage.getFilename())); rpc.logIn(adminUser); rpc.createAttachment(attachment); rpc.flushIndexQueue(); testContent = attachment; imageInHref = pdfName; runAutocomplete(); } }
private void testAttachmentOnContentObject(AbstractContentEntity contentEntityObject) { Attachment attachment = new Attachment(contentEntityObject, TEST_PDF, Attachment.PDF_TYPE, "", Classpath.getBytes(TEST_PDF)); rpc.createAttachment(attachment); editor.logInAndEdit(adminUser, contentEntityObject); MacroBrowser mb = editor.openMacroBrowser(); mb.selectMacro("viewpdf", false); waitUntilSelectBoxHasOption(mb, FILE_PARAM_NAME, TEST_PDF); }
public void testCommentHasAttachmentsListed() { Attachment attachment = new Attachment(testPage, TEST_PDF, Attachment.PDF_TYPE, "", Classpath.getBytes(TEST_PDF)); rpc.createAttachment(attachment); suite.logIn(User.ADMIN, testPage.getAddCommentUrl()); MacroBrowser mb = editor.openMacroBrowser(); mb.selectMacro("viewpdf", false); waitUntilSelectBoxHasOption(mb, FILE_PARAM_NAME, TEST_PDF); }
public void TODOXHTML_testAttachmentLink() { Attachment attachment = new Attachment(testPage, testImage); attachment.setId(rpc.createAttachment(attachment)); rpc.flushIndexQueue(); editor.createPage(testSpace); testContent = testImage; searchText = "Starry"; link = new EditorLink("attachment", "" + attachment.getId(), testImage.getTitle(), testImage.getDownloadUrl()); this.isAttachment = true; runAutocomplete(); }
public void testMacroBrowserCorrectlyPopulatesExistingParams() { Attachment attachment = new Attachment(testPage, TEST_PDF, Attachment.PDF_TYPE, "", Classpath.getBytes(TEST_PDF)); Attachment attachment2 = new Attachment(testPage, "foo.pdf", Attachment.PDF_TYPE, "", Classpath.getBytes(TEST_PDF)); rpc.createAttachment(attachment); rpc.createAttachment(attachment2); editor.logInAndEdit(adminUser, testPage); MacroBrowser mb = editor.openMacroBrowser(); mb.selectMacro("viewpdf", false); assertEquals(2, mb.getSelectOptions(FILE_PARAM_NAME).length); mb.selectOption(FILE_PARAM_NAME, attachment2.getFilename()); mb.clickInsert(); MacroPropertyPanel panel = tinyMce.selectMacro("viewpdf"); panel.clickEditButton(); waitUntilSelectBoxHasOption(mb, FILE_PARAM_NAME, attachment2.getFilename()); }
public void testClickSmallButtonForTallImage() { Attachment tallImage = new Attachment(testPage, "sunflowers.jpg", "image/jpeg", "sunflowers.jpg"); rpc.createAttachment(tallImage); editor.setContent(""); InsertImageDialog dialog = editor.insertImage(); dialog.chooseImage(tallImage.getFilename()); dialog.clickInsert(); ImagePropertyPanel ppanel = ImagePropertyPanel.launchFromClickOnImage(tinyMce, tallImage.getFilename()); ppanel.clickSmallButton(); assertImageWithSize(tallImage, ImagePropertyPanel.Size.HEIGHT_SMALL, true); }
public void testClickSmallButtonForImageOnOtherPage() { Page imagePage = new Page(testSpace, "Image Page", "foo"); rpc.savePage(imagePage); Attachment tallImage = new Attachment(imagePage, "sunflowers.jpg", "image/jpeg", "sunflowers.jpg"); rpc.createAttachment(tallImage); rpc.flushIndexQueue(); testPage.setContent("!TST:Image Page^sunflowers.jpg!"); rpc.savePage(testPage); editor.edit(testPage); ImagePropertyPanel ppanel = ImagePropertyPanel.launchFromClickOnImage(tinyMce, tallImage.getFilename()); ppanel.clickSmallButton(); assertImageWithSize(tallImage, ImagePropertyPanel.Size.HEIGHT_SMALL, true); }
public void testBlankPageTitleDefaultsToCurrentPage() throws Exception { Page page = new Page(testSpace,"title", "move it to OC"); rpc.createPage(page ); Attachment attachment = new Attachment(testPage, TEST_PDF, Attachment.PDF_TYPE, "", Classpath.getBytes(TEST_PDF)); rpc.createAttachment(attachment); editor.logInAndEdit(adminUser, testPage); MacroBrowser mb = editor.openMacroBrowser(); mb.selectMacro("viewpdf", false); changeParamValueAndTriggerChangeHandler(page.getTitle(), mb); waitUntilSelectBoxHasOption(mb, FILE_PARAM_NAME, NO_APPROPRIATE_ATTACHMENTS); changeParamValueAndTriggerChangeHandler("", mb); waitUntilSelectBoxHasOption(mb, FILE_PARAM_NAME, TEST_PDF); }