Author: dazarov
Date: 2007-12-29 08:00:06 -0500 (Sat, 29 Dec 2007)
New Revision: 5483
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1550
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2007-12-29
12:54:53 UTC (rev 5482)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2007-12-29
13:00:06 UTC (rev 5483)
@@ -105,6 +105,9 @@
refreshProject(project);
+ number = getMarkersNumber(bbcComponentFile);
+ assertFalse("Problem marker 'Duplicate component name' not found",
number == 0);
+
String[] messages = getMarkersMessage(bbcComponentFile);
assertTrue("Problem marker 'Duplicate component name' not
found","Duplicate component name: abcComponent".equals(messages[0]));
@@ -127,6 +130,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Stateful component does not contain @Remove
method' not found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Stateful component does not contain @Remove
method' not found", "Stateful component \"statefulComponent\" must
have a method marked @Remove".equals(messages[0]));
@@ -148,6 +154,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Stateful component does not contain @Destroy
method' not found' not found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Stateful component does not contain @Destroy
method' not found", "Stateful component \"statefulComponent\" must
have a method marked @Destroy".equals(messages[0]));
@@ -169,6 +178,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Stateful component has wrong scope' not
found' not found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Stateful component has wrong scope' not
found", "Stateful component \"statefulComponent\" should not have
org.jboss.seam.ScopeType.PAGE, nor
org.jboss.seam.ScopeType.STATELESS".equals(messages[0]));
@@ -191,6 +203,9 @@
refreshProject(project);
+ number = getMarkersNumber(componentsFile);
+ assertFalse("Problem marker 'Component class name cannot be resolved to a
type' not found' not found' not found", number == 0);
+
messages = getMarkersMessage(componentsFile);
assertTrue("Problem marker 'Component class name cannot be resolved to a
type' not found",
"\"org.domain.SeamWebTestProject.session.StateComponent\" cannot be
resolved to a type".equals(messages[0]));
@@ -223,6 +238,9 @@
refreshProject(project);
+ number = getMarkersNumber(componentsFile);
+ assertFalse("Problem marker 'Component class does not contain setter for
property' not found' not found' not found", number == 0);
+
messages = getMarkersMessage(componentsFile);
assertTrue("Problem marker 'Component class does not contain setter for
property' not found", "Class \"StatefulComponent\" of component
\"statefulComponent\" does not contain setter for property
\"abc\"".equals(messages[0]));
@@ -263,6 +281,9 @@
refreshProject(project);
+ number = getMarkersNumber(abcEntityFile);
+ assertFalse("Problem marker 'Entity component has wrong scope' not
found' not found' not found", number == 0);
+
String[] messages = getMarkersMessage(abcEntityFile);
assertTrue("Problem marker 'Entity component has wrong scope' not
found", "Entity component \"abcEntity\" should not have
org.jboss.seam.ScopeType.STATELESS".equals(messages[0]));
@@ -284,6 +305,9 @@
refreshProject(project);
+ number = getMarkersNumber(abcEntityFile);
+ assertFalse("Problem marker 'Duplicate @Remove method' not found' not
found' not found", number == 0);
+
messages = getMarkersMessage(abcEntityFile);
assertTrue("Problem marker 'Duplicate @Remove method' not found",
messages[0].startsWith("Duplicate @Remove method \"removeMethod"));
@@ -324,6 +348,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Duplicate @Destroy method' not found' not
found' not found", number == 0);
+
String[] messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Duplicate @Destroy method' not found",
messages[0].startsWith("Duplicate @Destroy method \"destroyMethod"));
@@ -354,6 +381,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Duplicate @Create method' not found' not
found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Duplicate @Create method' not found",
messages[0].startsWith("Duplicate @Create method \"createMethod"));
@@ -384,6 +414,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Duplicate @Unwrap method' not found' not
found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Duplicate @Unwrap method' not found",
messages[0].startsWith("Duplicate @Unwrap method \"unwrapMethod"));
@@ -423,6 +456,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Only component class can have @Destroy
method' not found' not found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Only component class can have @Destroy method'
not found", "Only component class can have @Destroy method
\"destroyMethod\"".equals(messages[0]));
@@ -444,6 +480,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Only component class can have @Create method'
not found' not found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Only component class can have @Create method'
not found", "Only component class can have @Create method
\"createMethod\"".equals(messages[0]));
@@ -465,6 +504,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Only component class can have @Unwrap method'
not found' not found' not found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Only component class can have @Unwrap method'
not found", "Only component class can have @Unwrap method
\"unwrapMethod\"".equals(messages[0]));
@@ -486,6 +528,9 @@
refreshProject(project);
+ number = getMarkersNumber(statefulComponentFile);
+ assertFalse("Problem marker 'Only component class can have @Observer
method' not found' not found' not found' not found", number == 0);
+
messages = getMarkersMessage(statefulComponentFile);
assertTrue("Problem marker 'Only component class can have @Observer
method' not found", "Only component class can have @Observer method
\"observerMethod\"".equals(messages[0]));
@@ -518,6 +563,9 @@
refreshProject(project);
+ number = getMarkersNumber(Component12File);
+ assertFalse("Problem marker 'Unknown factory name' not found' not
found' not found' not found", number == 0);
+
String[] messages = getMarkersMessage(Component12File);
assertTrue("Problem marker 'Unknown factory name' not found",
"Factory method \"messageList2\" with a void return type must have an
associated @Out/Databinder".equals(messages[0]));
@@ -525,7 +573,6 @@
int[] lineNumbers = getMarkersNumbersOfLine(Component12File);
assertTrue("Problem marker has wrong line number", lineNumbers[0] == 24);
-
}
public void testBijectionsValidator() {
@@ -564,6 +611,9 @@
}
refreshProject(project);
+
+ number = getMarkersNumber(selectionTestFile);
+ assertFalse("Problem marker 'Multiple data binder' not found' not
found' not found' not found", number == 0);
String[] messages = getMarkersMessage(selectionTestFile);
assertTrue("Problem marker 'Multiple data binder",
messages[0].startsWith("@DataModelSelection and @DataModelSelectionIndex without name
of the DataModel requires the only one @DataModel in the component"));
@@ -575,6 +625,9 @@
assertTrue("Problem marker has wrong line number", lineNumbers[0] == 21 ||
lineNumbers[0] == 24);
assertTrue("Problem marker has wrong line number", lineNumbers[0] == 21 ||
lineNumbers[0] == 24);
+ number = getMarkersNumber(selectionIndexTestFile);
+ assertFalse("Problem marker 'Multiple data binder' not found' not
found' not found' not found", number == 0);
+
messages = getMarkersMessage(selectionIndexTestFile);
assertTrue("Problem marker 'Multiple data binder",
messages[0].startsWith("@DataModelSelection and @DataModelSelectionIndex without name
of the DataModel requires the only one @DataModel in the component"));
@@ -607,6 +660,9 @@
}
refreshProject(project);
+
+ number = getMarkersNumber(selectionTestFile);
+ assertFalse("Problem marker 'Unknown @DataModel/@Out name' not found'
not found' not found' not found", number == 0);
messages = getMarkersMessage(selectionTestFile);
assertTrue("Problem marker 'Unknown @DataModel/@Out name",
messages[0].startsWith("Unknown @DataModel/@Out name: messageList2"));
@@ -614,6 +670,9 @@
lineNumbers = getMarkersNumbersOfLine(selectionTestFile);
assertTrue("Problem marker has wrong line number", lineNumbers[0] == 27);
+
+ number = getMarkersNumber(selectionIndexTestFile);
+ assertFalse("Problem marker 'Unknown @DataModel/@Out name' not found'
not found' not found' not found", number == 0);
messages = getMarkersMessage(selectionIndexTestFile);
assertTrue("Problem marker 'Unknown @DataModel/@Out name",
messages[0].startsWith("Unknown @DataModel/@Out name: messageList2"));
@@ -650,16 +709,18 @@
}
refreshProject(project);
-
+
String[] messages = getMarkersMessage(contextVariableTestFile);
assertTrue("Not all problem markers 'Duplicate variable name' was
found", messages.length == 4);
- assertTrue("Problem marker 'Duplicate variable name' not found",
"Duplicate variable name: messageList".equals(messages[0]));
+ for(int i=0;i<4;i++)
+ assertTrue("Problem marker 'Duplicate variable name' not found",
"Duplicate variable name: messageList".equals(messages[i]));
int[] lineNumbers = getMarkersNumbersOfLine(contextVariableTestFile);
- assertTrue("Problem marker has wrong line number", (lineNumbers[0] ==
16)||(lineNumbers[0] == 17)||(lineNumbers[0] == 36)||(lineNumbers[0] == 41));
+ for(int i=0;i<4;i++)
+ assertTrue("Problem marker has wrong line number", (lineNumbers[i] ==
16)||(lineNumbers[i] == 17)||(lineNumbers[i] == 36)||(lineNumbers[i] == 41));
// Unknown variable name
System.out.println("Test - Unknown variable name");
@@ -675,6 +736,9 @@
refreshProject(project);
+ number = getMarkersNumber(contextVariableTestFile);
+ assertFalse("Problem marker 'Unknown variable name' not found' not
found' not found' not found", number == 0);
+
messages = getMarkersMessage(contextVariableTestFile);
assertTrue("Problem marker 'Unknown variable name' not found",
"Unknown context variable name: messageList5".equals(messages[0]));
@@ -719,6 +783,9 @@
refreshProject(project);
+ number = getMarkersNumber(abcComponentXHTMLFile);
+ assertFalse("Problem marker 'Context variable cannot be resolved' not
found' not found' not found' not found", number == 0);
+
String[] messages = getMarkersMessage(abcComponentXHTMLFile);
assertTrue("Problem marker 'Context variable cannot be resolved' not
found", "bcComponent cannot be resolved".equals(messages[0]));
@@ -741,6 +808,9 @@
refreshProject(project);
+ number = getMarkersNumber(abcComponentXHTMLFile);
+ assertFalse("Problem marker 'Property cannot be resolved' not found'
not found' not found' not found", number == 0);
+
messages = getMarkersMessage(abcComponentXHTMLFile);
assertTrue("Problem marker 'Property cannot be resolved' not found",
"actionType2 cannot be resolved".equals(messages[0]));
@@ -776,6 +846,9 @@
}
refreshProject(project);
+
+ number = getMarkersNumber(abcComponentXHTMLFile);
+ assertFalse("Problem marker 'Unpaired Getter/Setter' not found' not
found' not found' not found", number == 0);
messages = getMarkersMessage(abcComponentXHTMLFile);
@@ -795,6 +868,9 @@
}
refreshProject(project);
+
+ number = getMarkersNumber(abcComponentXHTMLFile);
+ assertFalse("Problem marker 'Unpaired Getter/Setter' not found' not
found' not found' not found", number == 0);
messages = getMarkersMessage(abcComponentXHTMLFile);