Author: dazarov
Date: 2007-10-25 08:01:17 -0400 (Thu, 25 Oct 2007)
New Revision: 4510
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/session/StatefulComponent.6
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/EXIN-13
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/session/StatefulComponent.6
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/session/StatefulComponent.6
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/session/StatefulComponent.6 2007-10-25
12:01:17 UTC (rev 4510)
@@ -0,0 +1,56 @@
+package org.domain.SeamWebWarTestProject.session;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.log.Log;
+
+@Name("statefulComponent")
+
+@Stateful
+(a)Scope(ScopeType.APPLICATION)
+public class StatefulComponent {
+
+ private String abc;
+
+ @Logger private Log log;
+
+
+ //seam-gen method
+ public String statefulComponent()
+ {
+ //implement your business logic here
+ log.info("statefulComponent.statefulComponent() action called");
+ return "success";
+ }
+
+ //add additional action methods
+ @Destroy
+ public void destroyMethod(){
+
+ }
+
+ @Destroy
+ public void destroyMethod2(){
+
+ }
+
+ @Remove
+ public void removeMethod(){
+
+ }
+
+ public String getAbc() {
+ return abc;
+ }
+
+ public void setAbc(String abc) {
+ this.abc = abc;
+ }
+
+}
\ No newline at end of file
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-10-25
11:46:13 UTC (rev 4509)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2007-10-25
12:01:17 UTC (rev 4510)
@@ -99,9 +99,9 @@
refreshProject(project);
- String message = getMarkersMessage(bbcComponentFile);
+ String[] messages = getMarkersMessage(bbcComponentFile);
- assertTrue("Problem marker 'Duplicate component name' not
found","Duplicate component name: abcComponent".equals(message));
+ assertTrue("Problem marker 'Duplicate component name' not
found","Duplicate component name: abcComponent".equals(messages[0]));
// Stateful component does not contain @Remove method
System.out.println("Test - Stateful component does not contain @Remove
method");
@@ -117,8 +117,8 @@
refreshProject(project);
- message = getMarkersMessage(statefulComponentFile);
- assertTrue("Problem marker 'Stateful component does not contain @Remove
method' not found", "Stateful component \"statefulComponent\" must
have a method marked @Remove".equals(message));
+ 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]));
// Stateful component does not contain @Destroy method
System.out.println("Test - Stateful component does not contain @Destroy
method");
@@ -134,8 +134,8 @@
refreshProject(project);
- message = getMarkersMessage(statefulComponentFile);
- assertTrue("Problem marker 'Stateful component does not contain @Destroy
method' not found", "Stateful component \"statefulComponent\" must
have a method marked @Destroy".equals(message));
+ 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]));
// Stateful component has wrong scope
System.out.println("Test - Stateful component has wrong scope");
@@ -151,8 +151,8 @@
refreshProject(project);
- message = 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(message));
+ 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]));
// Component class name cannot be resolved to a type
System.out.println("Test - Component class name cannot be resolved to a
type");
@@ -169,8 +169,8 @@
refreshProject(project);
- message = 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(message));
+ 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]));
// Component class does not contain setter for property
System.out.println("Test - Component class does not contain setter for
property");
@@ -197,8 +197,8 @@
refreshProject(project);
- message = 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(message));
+ 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]));
}
public void testEntitiesValidator() {
@@ -227,8 +227,8 @@
refreshProject(project);
- String message = getMarkersMessage(statefulComponentFile);
- assertTrue("Problem marker 'Duplicate @Destroy method' not found",
"Stateful component \"statefulComponent\" must have a method marked
@Remove".equals(message));
+ String[] message = getMarkersMessage(statefulComponentFile);
+ assertTrue("Problem marker 'Duplicate @Destroy method' not found",
message[0].startsWith("Duplicate @Destroy method \"destroyMethod"));
// Duplicate @Create method
// Duplicate @Unwrap method
@@ -269,19 +269,21 @@
return -1;
}
- private String getMarkersMessage(IFile file){
- String message="";
+ private String[] getMarkersMessage(IFile file){
+ String[] messages = new String[1];
+ messages[0]="";
try{
IMarker[] markers = file.findMarkers(null, true, IResource.DEPTH_INFINITE);
+ messages = new String[markers.length];
for(int i=0;i<markers.length;i++){
System.out.println("Marker - "+markers[i].getAttribute(IMarker.MESSAGE,
""));
- message = markers[i].getAttribute(IMarker.MESSAGE, "");
+ messages[i] = markers[i].getAttribute(IMarker.MESSAGE, "");
}
}catch(CoreException ex){
JUnitUtils.fail("Error in getting problem markers", ex);
}
- return message;
+ return messages;
}
private void refreshProject(IProject project){