Thanks, Lincoln!

On Thu, Mar 8, 2012 at 6:12 PM, Lincoln Baxter, III <lincolnbaxter@gmail.com> wrote:
Specifically, this code in your test case does the trick:


   @Test
   public void testGitPluginNoProject() throws Exception
   {
       getShell().setCurrentResource(createTempFolder());
       ...
   }

As long as you are extending from AbstractShellTest, these functions will be available.


On Thu, Mar 8, 2012 at 10:30 AM, Lincoln Baxter, III <lincolnbaxter@gmail.com> wrote:
Hey guys,

I saw this come up during the meeting, and wanted to share the answer. It should be straightforward to simulate working "outside" of a project in a test case. Just create a temp folder (using the Java file API) then either CD to that folder, or get a resource handle to it by @Injecting the ResourceFactory, then set that resource as the current resource using:

shell.setCurrentResource(directory);

This is the best way I can think of to achieve this. If it's not working, then there's a bug somewhere, probably a nasty one :)

~Lincoln

--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"



--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"

_______________________________________________
forge-dev mailing list
forge-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev