[forge-dev] Working outside of a project during test case execution.

Ivan St. Ivanov ivan.st.ivanov at gmail.com
Thu Mar 8 11:25:13 EST 2012


Thanks, Lincoln!

On Thu, Mar 8, 2012 at 6:12 PM, Lincoln Baxter, III <lincolnbaxter at 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 at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20120308/72970dbf/attachment.html 


More information about the forge-dev mailing list