[jbosstools-commits] JBoss Tools SVN: r6982 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test: perfomance and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Mar 18 07:28:15 EDT 2008
Author: dsakovich
Date: 2008-03-18 07:28:15 -0400 (Tue, 18 Mar 2008)
New Revision: 6982
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/perfomance/PerfomanceTest.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1619
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-03-18 11:23:42 UTC (rev 6981)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-03-18 11:28:15 UTC (rev 6982)
@@ -30,6 +30,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1501Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1568Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1718Test;
+import org.jboss.tools.jsf.vpe.jsf.test.perfomance.PerfomanceTest;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
import org.jboss.tools.vpe.ui.test.beans.ImportBean;
@@ -72,11 +73,11 @@
// Perfomance Tests
// TODO dsakovich adjust perfomance tests
- // suite.addTestSuite(PerfomanceTest.class);
- // ImportBean importPerfomanceBean = new ImportBean();
- // importPerfomanceBean.setImportProjectName(PerfomanceTest.IMPORT_PROJECT_NAME);
- // importPerfomanceBean.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
- // projectToImport.add(importPerfomanceBean);
+ suite.addTestSuite(PerfomanceTest.class);
+ ImportBean importPerfomanceBean = new ImportBean();
+ importPerfomanceBean.setImportProjectName(PerfomanceTest.IMPORT_PROJECT_NAME);
+ importPerfomanceBean.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
+ projectToImport.add(importPerfomanceBean);
return new VpeTestSetup(suite, projectToImport);
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/perfomance/PerfomanceTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/perfomance/PerfomanceTest.java 2008-03-18 11:23:42 UTC (rev 6981)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/perfomance/PerfomanceTest.java 2008-03-18 11:28:15 UTC (rev 6982)
@@ -36,15 +36,16 @@
*/
public class PerfomanceTest extends VpeTest {
- public static final String IMPORT_PROJECT_NAME = "perfomanceTest";
+ public static final String IMPORT_PROJECT_NAME = "perfomanceTest"; //$NON-NLS-1$
- private static final String TEST_PAGE_NAME = "employee.xhtml";
- private static final String TEST_PAGE1_NAME = "home.xhtml";
- private static final String TEST_PAGE2_NAME = "addEmployee.xhtml";
- private static final String TEST_PAGE3_NAME = "pdataEdit.xhtml";
+ private static final String TEST_PAGE_NAME = "employee.xhtml"; //$NON-NLS-1$
+ private static final String TEST_PAGE1_NAME = "home.xhtml"; //$NON-NLS-1$
+ private static final String TEST_PAGE2_NAME = "addEmployee.xhtml"; //$NON-NLS-1$
+ private static final String TEST_PAGE3_NAME = "pdataEdit.xhtml"; //$NON-NLS-1$
- private static final String ANY_TAG = "<h:outputText value=\"Any Text\"/>";
-
+ private static final String ANY_TAG = "<h:outputText value=\"Any Text\"/>"; //$NON-NLS-1$
+ private static final int KEY_PRESS_TIME_INTERVAL = 300;
+
public PerfomanceTest(String name) {
super(name);
setCheckWarning(false);
@@ -63,28 +64,35 @@
IFile file = (IFile) TestUtil.getWebContentPath(TEST_PAGE_NAME,
IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file);
+ assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file); //$NON-NLS-1$
IEditorInput input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input);
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
TestUtil.waitForJobs();
final JSPMultiPageEditor parts = openEditor(input);
TestUtil.delay(1000L);
assertNotNull(parts);
-
- Job job = new UIJob("Test JBIDE-1105") {
+
+ Job job = new UIJob("Test JBIDE-1105") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
StyledText styledText = parts.getSourceEditor().getTextViewer()
.getTextWidget();
String delimiter = styledText.getLineDelimiter();
+ long start;
+ long finish;
for (int i = 0; i < 20; i++) {
int offset = styledText.getOffsetAtLine(21);
styledText.setCaretOffset(offset - delimiter.length());
+ start = System.currentTimeMillis();
styledText.insert(delimiter);
- TestUtil.delay(500L);
+ finish = System.currentTimeMillis();
+ // Check limit time
+ assertEquals(
+ "The limit time is expected",true, (finish-start)<KEY_PRESS_TIME_INTERVAL); //$NON-NLS-1$
+
}
return Status.OK_STATUS;
}
@@ -116,11 +124,11 @@
IFile file = (IFile) TestUtil.getWebContentPath(TEST_PAGE1_NAME,
IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE1_NAME, file);
+ assertNotNull("Could not open specified file " + TEST_PAGE1_NAME, file); //$NON-NLS-1$
IEditorInput input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input);
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
JSPMultiPageEditor parts = openEditor(input);
assertNotNull(parts);
@@ -133,11 +141,11 @@
file = (IFile) TestUtil.getWebContentPath(TEST_PAGE_NAME,
IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file);
+ assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file); //$NON-NLS-1$
input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input);
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
parts = openEditor(input);
assertNotNull(parts);
@@ -147,11 +155,11 @@
file = (IFile) TestUtil.getWebContentPath(TEST_PAGE2_NAME,
IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE2_NAME, file);
+ assertNotNull("Could not open specified file " + TEST_PAGE2_NAME, file); //$NON-NLS-1$
input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input);
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
parts = openEditor(input);
assertNotNull(parts);
@@ -161,11 +169,11 @@
file = (IFile) TestUtil.getWebContentPath(TEST_PAGE3_NAME,
IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE3_NAME, file);
+ assertNotNull("Could not open specified file " + TEST_PAGE3_NAME, file); //$NON-NLS-1$
input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input);
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
parts = openEditor(input);
assertNotNull(parts);
@@ -191,7 +199,7 @@
TestUtil.waitForJobs();
setException(null);
// Test page
- pageTest(TEST_PAGE_NAME, "test - work VPE with large files");
+ pageTest(TEST_PAGE_NAME, "test - work VPE with large files"); //$NON-NLS-1$
if (getException() != null) {
throw getException();
@@ -210,11 +218,11 @@
IFile file = (IFile) TestUtil.getWebContentPath(pageName,
IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file);
+ assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file); //$NON-NLS-1$
IEditorInput input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input);
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
TestUtil.waitForJobs();
final JSPMultiPageEditor parts = openEditor(input);
@@ -226,15 +234,20 @@
public IStatus runInUIThread(IProgressMonitor monitor) {
StyledText styledText = parts.getSourceEditor().getTextViewer()
.getTextWidget();
+ long start;
+ long finish;
String delimiter = styledText.getLineDelimiter();
int offset = styledText.getOffsetAtLine(21);
styledText.setCaretOffset(offset);
// Add any tag in source
for (int i = 0; i < ANY_TAG.length(); i++) {
- styledText.insert(String.valueOf(ANY_TAG.charAt(i)));
+ start = System.currentTimeMillis();
+ styledText.insert(String.valueOf(ANY_TAG.charAt(i)));
+ finish = System.currentTimeMillis();
+ // Check limit time
+ assertEquals("The limit time is expected",true, (finish-start)<KEY_PRESS_TIME_INTERVAL); //$NON-NLS-1$
offset++;
styledText.setCaretOffset(offset);
- TestUtil.delay(200);
}
styledText.insert(delimiter);
// Add any text(newline) in text
@@ -243,8 +256,11 @@
int line = random.nextInt(styledText.getLineCount());
offset = styledText.getOffsetAtLine(line);
styledText.setCaretOffset(offset - delimiter.length());
+ start = System.currentTimeMillis();
styledText.insert(delimiter);
- TestUtil.delay(500L);
+ finish = System.currentTimeMillis();
+ // Check limit time
+ assertEquals("The limit time is expected",true, (finish-start)<KEY_PRESS_TIME_INTERVAL); //$NON-NLS-1$
}
return Status.OK_STATUS;
}
More information about the jbosstools-commits
mailing list