From jbosstools-commits at lists.jboss.org Wed Jul 1 13:34:22 2009 Content-Type: multipart/mixed; boundary="===============3612400598498301292==" MIME-Version: 1.0 From: jbosstools-commits at lists.jboss.org To: jbosstools-commits at lists.jboss.org Subject: [jbosstools-commits] JBoss Tools SVN: r16324 - in trunk/seam/tests/org.jboss.tools.seam.core.test: projects/Test1-ejb/ejbModule/org/domain/Test1/session and 1 other directories. Date: Wed, 01 Jul 2009 13:19:10 -0400 Message-ID: <200907011719.n61HJAVx021682@svn01.web.mwc.hst.phx2.redhat.com> --===============3612400598498301292== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: dazarov Date: 2009-07-01 13:19:09 -0400 (Wed, 01 Jul 2009) New Revision: 16324 Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbMo= dule/org/domain/Test1/session/TestContextVariableFactory.java trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbMo= dule/org/domain/Test1/session/TestContextVariableOut.java trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebConten= t/factory.jsp trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebConten= t/out.jsp Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam= /core/test/refactoring/SeamContextVariableRefactoringTest.java Log: Tests for Rename Seam Context Variable https://jira.jboss.org/jira/browse/J= BIDE-1077 Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebCo= ntent/factory.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebConte= nt/factory.jsp (rev 0) +++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebConte= nt/factory.jsp 2009-07-01 17:19:09 UTC (rev 16324) @@ -0,0 +1,13 @@ +<%@ taglib uri=3D"http://java.sun.com/jsf/html" prefix=3D"h" %> +<%@ taglib uri=3D"http://java.sun.com/jsf/core" prefix=3D"f" %> + + + + + + + + + + = + = Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projec= ts/Test1/WebContent/factory.jsp ___________________________________________________________________ Name: svn:mime-type + text/plain Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebCo= ntent/out.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebConte= nt/out.jsp (rev 0) +++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1/WebConte= nt/out.jsp 2009-07-01 17:19:09 UTC (rev 16324) @@ -0,0 +1,13 @@ +<%@ taglib uri=3D"http://java.sun.com/jsf/html" prefix=3D"h" %> +<%@ taglib uri=3D"http://java.sun.com/jsf/core" prefix=3D"f" %> + + + + + + + + + + = + = Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projec= ts/Test1/WebContent/out.jsp ___________________________________________________________________ Name: svn:mime-type + text/plain Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/e= jbModule/org/domain/Test1/session/TestContextVariableFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbM= odule/org/domain/Test1/session/TestContextVariableFactory.java = (rev 0) +++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbM= odule/org/domain/Test1/session/TestContextVariableFactory.java 2009-07-01 1= 7:19:09 UTC (rev 16324) @@ -0,0 +1,38 @@ +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; + + +(a)Name("computer") +public class TestContextVariableFactory +{ + @Logger Log log; + = + @In Identity identity; + = + @In String main; + = + @In("main") boolean flag; + = + @Factory("abc") + int getVar(){ + return 2; + }; + = + @Factory + String getCba(){ + return "Test value is #{main.value}!"; + }; + = + public boolean calculate() + { + log.info("authenticating #0", identity.getUsername()); + identity.addRole("admin"); + return true; + } +} Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projec= ts/Test1-ejb/ejbModule/org/domain/Test1/session/TestContextVariableFactory.= java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/e= jbModule/org/domain/Test1/session/TestContextVariableOut.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbM= odule/org/domain/Test1/session/TestContextVariableOut.java = (rev 0) +++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/Test1-ejb/ejbM= odule/org/domain/Test1/session/TestContextVariableOut.java 2009-07-01 17:19= :09 UTC (rev 16324) @@ -0,0 +1,38 @@ +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.Out; +import org.jboss.seam.log.Log; +import org.jboss.seam.security.Identity; + + +(a)Name("computer2") +public class TestContextVariableFactory +{ + @Logger Log log; + = + @In Identity identity; + = + @In String main2; + = + @In("main2") boolean flag; + = + @Out("aaa") + int getVar(){ + return 2; + }; + = + @Out + String getDdd(){ + return "Test value is #{main2.value}!"; + }; + = + public boolean calculate() + { + log.info("authenticating #0", identity.getUsername()); + identity.addRole("admin"); + return true; + } +} Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/projec= ts/Test1-ejb/ejbModule/org/domain/Test1/session/TestContextVariableOut.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/too= ls/seam/core/test/refactoring/SeamContextVariableRefactoringTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/sea= m/core/test/refactoring/SeamContextVariableRefactoringTest.java 2009-07-01 = 16:21:37 UTC (rev 16323) +++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/sea= m/core/test/refactoring/SeamContextVariableRefactoringTest.java 2009-07-01 = 17:19:09 UTC (rev 16324) @@ -10,10 +10,7 @@ import org.eclipse.ltk.core.refactoring.TextFileChange; import org.eclipse.text.edits.MultiTextEdit; import org.jboss.tools.common.util.FileUtil; -import org.jboss.tools.seam.core.ISeamComponent; import org.jboss.tools.seam.core.ISeamProject; -import org.jboss.tools.seam.core.test.refactoring.SeamRefactoringTest.Test= ChangeStructure; -import org.jboss.tools.seam.core.test.refactoring.SeamRefactoringTest.Test= TextChange; import org.jboss.tools.seam.internal.core.refactoring.RenameSeamContextVar= iableProcessor; import org.jboss.tools.test.util.JobUtils; = @@ -22,13 +19,10 @@ super("Seam Context Variable Refactoring Test"); } = - private void renameContextVariable(ISeamProject seamProject, String fileN= ame, String variableName, String newName, List changeL= ist, boolean fromJar) throws CoreException{ + private void renameContextVariable(ISeamProject seamProject, String fileN= ame, String variableName, String newName, List changeL= ist) throws CoreException{ JobUtils.waitForIdle(2000); = // Test before renaming - ISeamComponent component =3D seamProject.getComponent(variableName); - assertNotNull("Can't load component " + variableName, component); - assertNull("There is unexpected component in seam project: " + newName, = seamProject.getComponent(newName)); for(TestChangeStructure changeStructure : changeList){ IFile file =3D changeStructure.getProject().getFile(changeStructure.get= FileName()); String content =3D null; @@ -38,11 +32,9 @@ } } = - assertNotNull("Component " + component.getName() + " does not have java = declaration.", component.getJavaDeclaration()); - = IFile sourceFile =3D seamProject.getProject().getFile(fileName); = - // Rename Seam Component + // Rename Seam Context Variable RenameSeamContextVariableProcessor processor =3D new RenameSeamContextVa= riableProcessor(sourceFile, variableName); processor.setNewName(newName); processor.checkInitialConditions(new NullProgressMonitor()); @@ -67,14 +59,10 @@ = = // Test results - if(!fromJar) - assertNull("There is unexpected component in seam project: " + variable= Name, seamProject.getComponent(variableName)); - assertNotNull("Can't load component " + newName, seamProject.getComponen= t(newName)); for(TestChangeStructure changeStructure : changeList){ IFile file =3D changeStructure.getProject().getFile(changeStructure.get= FileName()); String content =3D null; content =3D FileUtil.readStream(file.getContents()); - //System.out.println("File - "+file.getName()+" offset - "+changeStruct= ure.getOffset()+" expected - ["+changeStructure.getText()+"] actual - ["+co= ntent.substring(changeStructure.getOffset(), changeStructure.getOffset()+ch= angeStructure.getLength())+"]"); for(TestTextChange change : changeStructure.getTextChanges()){ assertEquals("There is unexpected change in resource - "+file.getName(= ),change.getText(), content.substring(change.getOffset(), change.getOffset(= )+change.getLength())); } @@ -135,6 +123,74 @@ structure.addTextChange(change); list.add(structure); = - renameContextVariable(seamEjbProject, "/WebContent/test.jsp", "test", "b= est", list, false); + renameContextVariable(seamEjbProject, "/WebContent/test.jsp", "test", "b= est", list); } + = + public void testSeamContextVariable_Factory1_Rename() throws CoreExceptio= n { + ArrayList list =3D new ArrayList(); + + TestChangeStructure structure =3D new TestChangeStructure(ejbProject.get= Project(), "/ejbModule/org/domain/"+warProjectName+"/session/TestContextVar= iableFactory.java"); + TestTextChange change =3D new TestTextChange(464, 5, "\"bbc\""); + structure.addTextChange(change); + list.add(structure); + = + structure =3D new TestChangeStructure(warProject, "/WebContent/factory.j= sp"); + change =3D new TestTextChange(227, 3, "bbc"); + structure.addTextChange(change); + list.add(structure); + = + renameContextVariable(seamEjbProject, "/WebContent/factory.jsp", "abc", = "bbc", list); + } + = + public void testSeamContextVariable_Factory2_Rename() throws CoreExceptio= n { + ArrayList list =3D new ArrayList(); + + TestChangeStructure structure =3D new TestChangeStructure(ejbProject.get= Project(), "/ejbModule/org/domain/"+warProjectName+"/session/TestContextVar= iableFactory.java"); + TestTextChange change =3D new TestTextChange(528, 7, "(\"ccc\")"); + structure.addTextChange(change); + list.add(structure); + = + structure =3D new TestChangeStructure(warProject, "/WebContent/factory.j= sp"); + change =3D new TestTextChange(283, 3, "ccc"); + structure.addTextChange(change); + list.add(structure); + = + renameContextVariable(seamEjbProject, "/WebContent/factory.jsp", "cba", = "ccc", list); + } + + public void t_estSeamContextVariable_Out1_Rename() throws CoreException { + ArrayList list =3D new ArrayList(); + + TestChangeStructure structure =3D new TestChangeStructure(ejbProject.get= Project(), "/ejbModule/org/domain/"+warProjectName+"/session/TestContextVar= iableOut.java"); + TestTextChange change =3D new TestTextChange(464, 5, "\"bbb\""); + structure.addTextChange(change); + list.add(structure); + = + structure =3D new TestChangeStructure(warProject, "/WebContent/out.jsp"); + change =3D new TestTextChange(227, 3, "bbb"); + structure.addTextChange(change); + list.add(structure); + = + renameContextVariable(seamEjbProject, "/WebContent/out.jsp", "aaa", "bbb= ", list); + } + = + public void t_estSeamContextVariable_Out2_Rename() throws CoreException { + ArrayList list =3D new ArrayList(); + + TestChangeStructure structure =3D new TestChangeStructure(ejbProject.get= Project(), "/ejbModule/org/domain/"+warProjectName+"/session/TestContextVar= iableOut.java"); + TestTextChange change =3D new TestTextChange(464, 5, "\"eee\""); + structure.addTextChange(change); + list.add(structure); + = + structure =3D new TestChangeStructure(warProject, "/WebContent/out.jsp"); + change =3D new TestTextChange(227, 3, "eee"); + structure.addTextChange(change); + list.add(structure); + = + renameContextVariable(seamEjbProject, "/WebContent/out.jsp", "ddd", "eee= ", list); + } + + public void testSeamContextVariable_DataModel_Rename() throws CoreExcepti= on { + = + } } --===============3612400598498301292==--