public void testJbide() throws Throwable { // get test page path IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME, RichFacesAllTests.IMPORT_PROJECT_NAME); assertNotNull( "Could not open specified file. componentPage = " + TEST_PAGE_NAME + ";projectName = " + RichFacesAllTests.IMPORT_PROJECT_NAME, file); //$NON-NLS-1$ IEditorInput input = new FileEditorInput(file); assertNotNull("Editor input is null", input); // open and get editor JSPMultiPageEditor part = openEditor(input); // get dom document nsIDOMDocument document = TestUtil.getVpeVisualDocument(part); nsIDOMElement element = document.getDocumentElement(); assertNotNull(element); // get root node nsIDOMNode node = queryInterface(element, nsIDOMNode.class); List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>(); // find "table" elements TestUtil.findElementsByName(node, elements, HTML.TAG_TABLE); assertEquals(2, elements.size()); // get first table. It has default attributes (minValue=0, maxValue=100) nsIDOMNode defaultInputSlider = elements.get(0); // check min-,max- values checkMinMaxValue(defaultInputSlider, 0, 100); // get first table. It has edited attributes (minValue=-10, // maxValue=200) nsIDOMNode editedInputSlider = elements.get(1); // check min-,max- values checkMinMaxValue(editedInputSlider, -10, 200); // check exception if (getException() != null) { throw getException(); } }
@Override protected void setUp() throws Exception { super.setUp(); setException(null); this.file = (IFile) TestUtil.getComponentPath( TEST_FILE_NAME, //$NON-NLS-1$ JsfAllTests.IMPORT_PROJECT_NAME); ResourceReference[] entries = new ResourceReference[1]; entries[0] = new ResourceReference("request.contextPath", ResourceReference.FILE_SCOPE); entries[0].setProperties("contextPathFolder"); ELReferenceList.getInstance().setAllResources(this.file, entries); }
@Test public void testJBIDE1479() throws Throwable { // wait setException(null); // get test page path final IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME, JsfAllTests.IMPORT_PROJECT_NAME); assertNotNull( "Could not open specified file " + TEST_PAGE_NAME, // $NON-NLS-1$ file); IEditorInput input = new FileEditorInput(file); assertNotNull("Editor input is null", input); // $NON-NLS-1$ JSPMultiPageEditor part = openEditor(input); TestUtil.waitForIdle(120 * 1000); assertNotNull(part); Job job = new WorkspaceJob("Test JBIDE-1479") { // $NON-NLS-1$ @Override public IStatus runInWorkspace(IProgressMonitor monitor) { try { new FormatProcessorXML().formatFile(file); } catch (CoreException e) { TestUtil.fail(e); } catch (IOException e) { TestUtil.fail(e); } return Status.OK_STATUS; } }; job.setPriority(Job.SHORT); job.schedule(0L); job.join(); TestUtil.waitForIdle(15 * 1000 * 60); TestUtil.delay(1000L); closeEditors(); /* * we ignore this code, because we are testint JBIDE-1479, * it's test fot crash of eclipse.And if we modifying content from non-ui thread, we almost * always will get SWTException 'access violation'. */ // if(getException()!=null) { // throw getException(); // } }
/** * Checks if the first element in the test file is selected in the VPE when the VPE is just * loaded. * * @throws Throwable */ public void testJBIDE4037Test() throws Throwable { setException(null); IFile ifile = (IFile) TestUtil.getComponentPath(FILE_PATH, JsfAllTests.IMPORT_PROJECT_NAME); IEditorInput input = new FileEditorInput(ifile); JSPMultiPageEditor part = openEditor(input); TestUtil.waitForJobs(); nsIDOMElement rootElement = TestUtil.getVpeController(part).getXulRunnerEditor().getSelectedElement(); // check if something selected assertNotNull(rootElement); // check if the selected element is the first element on the page (we know its ID) assertEquals(ROOT_ELEMENT_ID, rootElement.getAttribute(HTML.ATTR_ID)); if (getException() != null) { throw getException(); } }
/** * If there are several f:views on the page. Only the last f:view one should be applied on server, * but each f:view should have its own locale. * * @throws Throwable */ public void testSeveralFViewsWithLocales() throws Throwable { IFile file = (IFile) TestUtil.getComponentPath(SEVERAL_FVIEWS_PAGE, JsfAllTests.IMPORT_JSF_20_PROJECT_NAME); assertNotNull( "Could not open specified file." //$NON-NLS-1$ + " componentPage = " + SEVERAL_FVIEWS_PAGE //$NON-NLS-1$ + ";projectName = " + JsfAllTests.IMPORT_JSF_20_PROJECT_NAME, file); //$NON-NLS-1$ IEditorInput input = new FileEditorInput(file); assertNotNull("Editor input is null", input); // $NON-NLS-1$ /* * open and get the editor */ JSPMultiPageEditor part = openEditor(input); VpeController controller = TestUtil.getVpeController(part); javaSources = EclipseResourceUtil.getJavaProjectSrcLocations(file.getProject()); nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument(); nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT0_ID); String localizedText = getLocalizedText(localeText); checkLocaleStrings(file, "en", localizedText); // $NON-NLS-1$ localeText = doc.getElementById(LOCALE_TEXT1_ID); localizedText = getLocalizedText(localeText); checkLocaleStrings(file, "de", localizedText); // $NON-NLS-1$ localeText = doc.getElementById(LOCALE_TEXT2_ID); localizedText = getLocalizedText(localeText); /* * f:view will use default locale if nothing is specified. */ checkLocaleStrings(file, "en_US", localizedText); // $NON-NLS-1$ localeText = doc.getElementById(LOCALE_TEXT_ID); localizedText = getLocalizedText(localeText); checkLocaleStrings(file, "en_GB", localizedText); // $NON-NLS-1$ closeEditors(); }