Author: dazarov
Date: 2009-05-15 12:39:14 -0400 (Fri, 15 May 2009)
New Revision: 15308
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.jsp
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.properties
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestComponent.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestSeamComponent.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.jsp
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.properties
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/seam.properties
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamComponentRefactoringTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringAllTests.java
Log:
Tests for
https://jira.jboss.org/jira/browse/JBIDE-1077
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.jsp
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.jsp
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.jsp 2009-05-15
16:39:14 UTC (rev 15308)
@@ -0,0 +1,12 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="Test value is #{test.value}!" />
+ </f:view>
+ </body>
+</html>
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.properties
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.properties
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.properties 2009-05-15
16:39:14 UTC (rev 15308)
@@ -0,0 +1 @@
+TEST_VALUE = This value is #{test.value}!
\ No newline at end of file
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebContent/test.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.jsp
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.jsp
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.jsp 2009-05-15
16:39:14 UTC (rev 15308)
@@ -0,0 +1,12 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="Test value is #{test.value}!" />
+ </f:view>
+ </body>
+</html>
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.properties
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.properties
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.properties 2009-05-15
16:39:14 UTC (rev 15308)
@@ -0,0 +1 @@
+TEST_VALUE = This value is #{test.value}!
\ No newline at end of file
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ear/EarContent/test.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestComponent.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestComponent.java
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestComponent.java 2009-05-15
16:39:14 UTC (rev 15308)
@@ -0,0 +1,22 @@
+package org.domain.Test1.session;
+
+import org.jboss.seam.annotations.*;
+
+@Name(value="test")
+public class TestComponent {
+
+ String password;
+
+ public Object getPart(){
+ return null;
+ }
+
+ public boolean operate(){
+ return true;
+ }
+
+ public String value(){
+ return "Default Value";
+ }
+
+}
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestSeamComponent.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestSeamComponent.java
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestSeamComponent.java 2009-05-15
16:39:14 UTC (rev 15308)
@@ -0,0 +1,41 @@
+package org.domain.Test1.session;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.security.Identity;
+
+
+@Name("component")
+public class TestSeamComponent
+{
+ @Logger Log log;
+
+ @In Identity identity;
+
+ @In String test;
+
+ @In("test") boolean flag;
+
+ @Factory("test")
+ int getVar(){
+ return 2;
+ };
+
+ @Factory
+ String getTest(){
+ return "Test value is #{test.value}!";
+ };
+
+ public boolean authenticate()
+ {
+ log.info("authenticating #0", identity.getUsername());
+ //write your authentication logic here,
+ //return true if the authentication was
+ //successful, false otherwise
+ identity.addRole("admin");
+ return true;
+ }
+}
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/org/domain/Test1/session/TestSeamComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/seam.properties
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/seam.properties 2009-05-15
16:38:06 UTC (rev 15307)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbModule/seam.properties 2009-05-15
16:39:14 UTC (rev 15308)
@@ -0,0 +1 @@
+test.operate = Test Component Operation
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamComponentRefactoringTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamComponentRefactoringTest.java 2009-05-15
16:38:06 UTC (rev 15307)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamComponentRefactoringTest.java 2009-05-15
16:39:14 UTC (rev 15308)
@@ -19,9 +19,14 @@
import junit.framework.TestCase;
public class SeamComponentRefactoringTest extends TestCase {
- static String warProjectName = "SeamWebWarTestProject";
+ static String warProjectName = "Test1";
+ static String earProjectName = "Test1-ear";
+ static String ejbProjectName = "Test1-ejb";
static IProject warProject;
+ static IProject earProject;
+ static IProject ejbProject;
static ISeamProject seamWarProject;
+ static ISeamProject seamEjbProject;
public SeamComponentRefactoringTest(){
super("Seam Component Refactoring Test");
@@ -34,62 +39,84 @@
if(seamWarProject==null) {
seamWarProject = loadSeamProject(warProject);
}
+
+ if(earProject==null) {
+ earProject = ProjectImportTestSetup.loadProject(earProjectName);
+ }
+
+ if(ejbProject==null) {
+ ejbProject = ProjectImportTestSetup.loadProject(ejbProjectName);
+ }
+ if(seamEjbProject==null) {
+ seamEjbProject = loadSeamProject(ejbProject);
+ }
}
private ISeamProject loadSeamProject(IProject project) throws CoreException {
+ JobUtils.waitForIdle();
+ System.out.println("Project - "+project);
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
assertNotNull("Seam project for " + project.getName() + " is null",
seamProject);
- JobUtils.waitForIdle();
+
return seamProject;
}
public void testSeamComponentRename() throws CoreException {
ArrayList<TestChangeStructure> list = new
ArrayList<TestChangeStructure>();
- TestChangeStructure structure = new
TestChangeStructure("/src/action/org/domain/SeamWebWarTestProject/session/TestComponent.java",
- 113, 6, "\"best\"");
+ TestChangeStructure structure = new TestChangeStructure(ejbProject.getProject(),
"/ejbModule/org/domain/"+warProjectName+"/session/TestComponent.java",
+ 89, 6, "\"best\"");
list.add(structure);
-
+ /*
structure = new TestChangeStructure("/WebContent/WEB-INF/components.xml",
2660, 6, "best");
list.add(structure);
structure = new TestChangeStructure("/WebContent/WEB-INF/components.xml",
2756, 4, "best");
list.add(structure);
-
- structure = new
TestChangeStructure("/src/action/org/domain/SeamWebWarTestProject/session/TestSeamComponent.java",
- 413, 0, "(\"best\")");
+ */
+ structure = new TestChangeStructure(ejbProject,
"/ejbModule/org/domain/"+warProjectName+"/session/TestSeamComponent.java",
+ 420, 11, "@In(\"best\")");
list.add(structure);
- structure = new
TestChangeStructure("/src/action/org/domain/SeamWebWarTestProject/session/TestSeamComponent.java",
- 436, 11, "@In(\"best\")");
+ structure = new TestChangeStructure(ejbProject,
"/ejbModule/org/domain/"+warProjectName+"/session/TestSeamComponent.java",
+ 389, 8, "(\"best\")");
list.add(structure);
- structure = new
TestChangeStructure("/src/action/org/domain/SeamWebWarTestProject/session/TestSeamComponent.java",
- 471, 16, "@Factory(\"best\")");
+ structure = new TestChangeStructure(ejbProject,
"/ejbModule/org/domain/"+warProjectName+"/session/TestSeamComponent.java",
+ 455, 16, "@Factory(\"best\")");
list.add(structure);
- structure = new
TestChangeStructure("/src/action/org/domain/SeamWebWarTestProject/session/TestSeamComponent.java",
- 545, 0, "(\"best\")");
+ structure = new TestChangeStructure(ejbProject,
"/ejbModule/org/domain/"+warProjectName+"/session/TestSeamComponent.java",
+ 529, 8, "(\"best\")");
list.add(structure);
- structure = new
TestChangeStructure("/src/action/org/domain/SeamWebWarTestProject/session/TestSeamComponent.java",
- 597, 4, "best");
+ structure = new TestChangeStructure(ejbProject,
"/ejbModule/org/domain/"+warProjectName+"/session/TestSeamComponent.java",
+ 589, 4, "best");
list.add(structure);
- structure = new TestChangeStructure("/src/seam.properties",
+ structure = new TestChangeStructure(ejbProject,
"/ejbModule/seam.properties",
0, 4, "best");
list.add(structure);
- structure = new TestChangeStructure("/WebContent/login.xhtml",
- 1033, 4, "best");
+ structure = new TestChangeStructure(warProject, "/WebContent/test.jsp",
+ 227, 4, "best");
list.add(structure);
- structure = new TestChangeStructure("/WebContent/refactoring_test.jsp",
+ structure = new TestChangeStructure(warProject,
"/WebContent/test.properties",
+ 29, 4, "best");
+ list.add(structure);
+
+ structure = new TestChangeStructure(earProject, "/EarContent/test.jsp",
227, 4, "best");
list.add(structure);
- structure = new TestChangeStructure("/WebContent/test.properties",
+ structure = new TestChangeStructure(earProject,
"/EarContent/test.properties",
29, 4, "best");
list.add(structure);
- renameComponent(seamWarProject, "test", "best", list);
+ /*
+ structure = new TestChangeStructure("/WebContent/login.xhtml",
+ 1033, 4, "best");
+ list.add(structure);
+ */
+ renameComponent(seamEjbProject, "test", "best", list);
}
private void renameComponent(ISeamProject seamProject, String componentName, String
newName, List<TestChangeStructure> changeList) throws CoreException{
@@ -99,7 +126,7 @@
assertNotNull(component);
assertNull(seamProject.getComponent(newName));
for(TestChangeStructure changeStructure : changeList){
- IFile file = seamProject.getProject().getFile(changeStructure.getFileName());
+ IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
String content = null;
content = FileUtil.readStream(file.getContents());
assertNotSame(changeStructure.getText(),
content.substring(changeStructure.getOffset(),
changeStructure.getOffset()+changeStructure.getLength()));
@@ -116,26 +143,33 @@
assertNull(seamProject.getComponent(componentName));
assertNotNull(seamProject.getComponent(newName));
for(TestChangeStructure changeStructure : changeList){
- IFile file = seamProject.getProject().getFile(changeStructure.getFileName());
+ IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
String content = null;
content = FileUtil.readStream(file.getContents());
+ System.out.println("File - "+file.getName()+" offset -
"+changeStructure.getOffset()+" expected -
["+changeStructure.getText()+"] actual -
["+content.substring(changeStructure.getOffset(),
changeStructure.getOffset()+changeStructure.getLength())+"]");
assertEquals(changeStructure.getText(), content.substring(changeStructure.getOffset(),
changeStructure.getOffset()+changeStructure.getLength()));
}
}
class TestChangeStructure{
+ private IProject project;
private String fileName;
private int offset;
private int length;
private String text;
- public TestChangeStructure(String fileName, int offset, int length, String text){
+ public TestChangeStructure(IProject project, String fileName, int offset, int length,
String text){
+ this.project = project;
this.fileName = fileName;
this.offset = offset;
this.length = length;
this.text = text;
}
+ public IProject getProject(){
+ return project;
+ }
+
public String getFileName(){
return fileName;
}
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringAllTests.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringAllTests.java 2009-05-15
16:38:06 UTC (rev 15307)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringAllTests.java 2009-05-15
16:39:14 UTC (rev 15308)
@@ -28,8 +28,8 @@
new String[]{"RefactoringTestProject-war",
"RefactoringTestProject-ejb", "RefactoringTestProject-test"}));
suite.addTest(new ProjectImportTestSetup(new
TestSuite(SeamComponentRefactoringTest.class),
"org.jboss.tools.seam.core.test",
- new String[]{"projects/SeamWebWarTestProject"},
- new String[]{"SeamWebWarTestProject"}));
+ new
String[]{"projects/Test1","projects/Test1-ear","projects/Test1-ejb"},
+ new String[]{"Test1","Test1-ear","Test1-ejb"}));
return suite;
}
}
\ No newline at end of file