Different main/test directory layouts for framework and applications/plugins?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Different main/test directory layouts for framework and applications/plugins?

Michael Brohl-3
Hi everyone,

I just stumbled about the fact that we have different directory
structures for main and test code between framework and
applications/plugins.

In framework, we have a structure

    src/main/java

    src/main/test

In applications and plugins, we only have

    src/main/java


The test classes for apps/plugins are in /test subfolders for each
app/plugin.

I tried to use the framework layout for a custom plugin and found that
the test classes are not recognized then (ClassNotFoundException). I
guess that src/main/test is not recognized by the class loader for
apps/plugins.


Can someone confirm this?

Is this a flaw or is there a reason behind the different layouts?


I think it would be good to have the same layout throughout the code. If
someone can point me to the right spot, I would be happy to work on this.


Thanks and best regards,

Michael




smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Different main/test directory layouts for framework and applications/plugins?

taher
Hi Michael,

The layouts are exactly the same between all components whether be it
in framework, applications or plugins. Adding a directory called
/src/test/java is _optional_. If you create a directory like that and
place java files in it, then any junit "@Test" will run automatically.
Check the start or base components for some references.

Also, again to reiterate, it is /src/test/java, not /src/main/test

On Fri, Sep 8, 2017 at 4:08 PM, Michael Brohl <[hidden email]> wrote:

> Hi everyone,
>
> I just stumbled about the fact that we have different directory structures
> for main and test code between framework and applications/plugins.
>
> In framework, we have a structure
>
>    src/main/java
>
>    src/main/test
>
> In applications and plugins, we only have
>
>    src/main/java
>
>
> The test classes for apps/plugins are in /test subfolders for each
> app/plugin.
>
> I tried to use the framework layout for a custom plugin and found that the
> test classes are not recognized then (ClassNotFoundException). I guess that
> src/main/test is not recognized by the class loader for apps/plugins.
>
>
> Can someone confirm this?
>
> Is this a flaw or is there a reason behind the different layouts?
>
>
> I think it would be good to have the same layout throughout the code. If
> someone can point me to the right spot, I would be happy to work on this.
>
>
> Thanks and best regards,
>
> Michael
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Different main/test directory layouts for framework and applications/plugins?

Michael Brohl-3
Thanks Taher,

sorry, I had a typo in my description. Of course I have src/test/java.

Thanks for the confirmation that framework, apps and plugins are all
treated the same, there mus be a problem on my side then.

Best regards,

Michael


Am 08.09.17 um 15:17 schrieb Taher Alkhateeb:

> Hi Michael,
>
> The layouts are exactly the same between all components whether be it
> in framework, applications or plugins. Adding a directory called
> /src/test/java is _optional_. If you create a directory like that and
> place java files in it, then any junit "@Test" will run automatically.
> Check the start or base components for some references.
>
> Also, again to reiterate, it is /src/test/java, not /src/main/test
>
> On Fri, Sep 8, 2017 at 4:08 PM, Michael Brohl <[hidden email]> wrote:
>> Hi everyone,
>>
>> I just stumbled about the fact that we have different directory structures
>> for main and test code between framework and applications/plugins.
>>
>> In framework, we have a structure
>>
>>     src/main/java
>>
>>     src/main/test
>>
>> In applications and plugins, we only have
>>
>>     src/main/java
>>
>>
>> The test classes for apps/plugins are in /test subfolders for each
>> app/plugin.
>>
>> I tried to use the framework layout for a custom plugin and found that the
>> test classes are not recognized then (ClassNotFoundException). I guess that
>> src/main/test is not recognized by the class loader for apps/plugins.
>>
>>
>> Can someone confirm this?
>>
>> Is this a flaw or is there a reason behind the different layouts?
>>
>>
>> I think it would be good to have the same layout throughout the code. If
>> someone can point me to the right spot, I would be happy to work on this.
>>
>>
>> Thanks and best regards,
>>
>> Michael
>>
>>
>>


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Different main/test directory layouts for framework and applications/plugins?

taher
Yeah, I double checked on my computer just in case, and I can confirm it works.

So most likely because you're facing "ClassNotFoundException" it's a
path issue. Maybe a typo in the package name or something like that.
Alternatively maybe the whole plugin is not recognized for some
reason. In that case it could be maybe that the component is disabled.

On Fri, Sep 8, 2017 at 4:44 PM, Michael Brohl <[hidden email]> wrote:

> Thanks Taher,
>
> sorry, I had a typo in my description. Of course I have src/test/java.
>
> Thanks for the confirmation that framework, apps and plugins are all treated
> the same, there mus be a problem on my side then.
>
> Best regards,
>
> Michael
>
>
> Am 08.09.17 um 15:17 schrieb Taher Alkhateeb:
>
>> Hi Michael,
>>
>> The layouts are exactly the same between all components whether be it
>> in framework, applications or plugins. Adding a directory called
>> /src/test/java is _optional_. If you create a directory like that and
>> place java files in it, then any junit "@Test" will run automatically.
>> Check the start or base components for some references.
>>
>> Also, again to reiterate, it is /src/test/java, not /src/main/test
>>
>> On Fri, Sep 8, 2017 at 4:08 PM, Michael Brohl <[hidden email]>
>> wrote:
>>>
>>> Hi everyone,
>>>
>>> I just stumbled about the fact that we have different directory
>>> structures
>>> for main and test code between framework and applications/plugins.
>>>
>>> In framework, we have a structure
>>>
>>>     src/main/java
>>>
>>>     src/main/test
>>>
>>> In applications and plugins, we only have
>>>
>>>     src/main/java
>>>
>>>
>>> The test classes for apps/plugins are in /test subfolders for each
>>> app/plugin.
>>>
>>> I tried to use the framework layout for a custom plugin and found that
>>> the
>>> test classes are not recognized then (ClassNotFoundException). I guess
>>> that
>>> src/main/test is not recognized by the class loader for apps/plugins.
>>>
>>>
>>> Can someone confirm this?
>>>
>>> Is this a flaw or is there a reason behind the different layouts?
>>>
>>>
>>> I think it would be good to have the same layout throughout the code. If
>>> someone can point me to the right spot, I would be happy to work on this.
>>>
>>>
>>> Thanks and best regards,
>>>
>>> Michael
>>>
>>>
>>>
>
>