You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by snowc <ch...@gmail.com> on 2009/08/14 15:10:17 UTC

is compile and ofbiz restart still needed for java changes?

Everytime I make a change to java code, I run "ant" and then restart the
ofbiz service to pick up the changes.

Is this still necessary?  I am running r4.0.  What about 9.04
-- 
View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: is compile and ofbiz restart still needed for java changes?

Posted by Bob Morley <rm...@emforium.com>.
I have created a first shot at making use of mocking in unit tests.  You can
take a look at https://issues.apache.org/jira/browse/OFBIZ-2842.  There are
more notes on the ticket; but here are some highlights:

- selected "mockito" framework (MIT lic)
- created a new BaseTestCase
- extended to an OfbizMockTestCase (in services) with mocked delegator,
disaptcher, and dctx.  Also has some testcase extensions to make checking
success/error of services easier, creating service context, etc.
- wrote CommonDimensionServicesTest

This guy does not require an ofbiz container and runs inside my Eclipse in
about .5s (granted it does not test a whole lot).  It tests some failure
scenarios as well as a successful "creation" of a DateDimension entity.  One
thing you will notice is that it is easy to test "exception" scenarios.  So
testing error handling for situations like database deadlocks become very
easy to do.  Moreover, you can test third party integration logic using
similar techniques.


Tim Ruppert wrote:
> 
> +1 - would be super helpful.
> 
> Cheers,
> Tim
> --
> Tim Ruppert
> HotWax Media
> http://www.hotwaxmedia.com
> 
> o:801.649.6594
> f:801.649.6595
> 
> On Aug 18, 2009, at 12:05 AM, snowc wrote:
> 
>>
>> Hi Bob,  The mocking code sounds great.  Would you be happy to share?
>>
>>
> 

-- 
View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p25038084.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: is compile and ofbiz restart still needed for java changes?

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
+1 - would be super helpful.

Cheers,
Tim
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595

On Aug 18, 2009, at 12:05 AM, snowc wrote:

>
> Hi Bob,  The mocking code sounds great.  Would you be happy to share?
>
>
> Bob Morley wrote:
>>
>> We typically execute Ofbiz from Eclipse and some people have  
>> reported that
>> the hot-swapping works fairly well.  (Usually we do not run an ant  
>> build
>> until right before check-in and then just to ensure we are  
>> compiling and
>> avoiding classpath issues).
>>
>> The approach I often take is to write my unit test in conjunction  
>> with the
>> service implementation I am working on.  I have added some mocking
>> capabilities in our Ofbiz installation, so I can avoid starting up  
>> the
>> container at all and still exercise all of the logic in the service
>> method.  Result is usually a sub-second unit test.  Naturally an
>> integration test would require container start-up and a reasonably  
>> heavy
>> penalty.
>>
>> Another approach others have used is to write the service method in  
>> groovy
>> and once working convert this into java.  From memory there is  
>> really only
>> a single sample of a groovy implemented service, and when I went to  
>> do
>> there there was at least one bug I had to resolve.  But this is a  
>> feasible
>> way and the groovy is quite a bit like java.  :)
>>
>> - Bob
>>
>>
>> Ruth Hoffman-2 wrote:
>>>
>>> Hi Chris:
>>> I guess I'm just use to the inconvenience. :-( The other thing I  
>>> do to
>>> try and minimize restart time is to comment out the components I  
>>> might
>>> not be using.
>>> Ruth
>>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p25019021.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Re: is compile and ofbiz restart still needed for java changes?

Posted by snowc <ch...@gmail.com>.
Hi Bob,  The mocking code sounds great.  Would you be happy to share?


Bob Morley wrote:
> 
> We typically execute Ofbiz from Eclipse and some people have reported that
> the hot-swapping works fairly well.  (Usually we do not run an ant build
> until right before check-in and then just to ensure we are compiling and
> avoiding classpath issues).
> 
> The approach I often take is to write my unit test in conjunction with the
> service implementation I am working on.  I have added some mocking
> capabilities in our Ofbiz installation, so I can avoid starting up the
> container at all and still exercise all of the logic in the service
> method.  Result is usually a sub-second unit test.  Naturally an
> integration test would require container start-up and a reasonably heavy
> penalty.
> 
> Another approach others have used is to write the service method in groovy
> and once working convert this into java.  From memory there is really only
> a single sample of a groovy implemented service, and when I went to do
> there there was at least one bug I had to resolve.  But this is a feasible
> way and the groovy is quite a bit like java.  :)
> 
> - Bob
> 
> 
> Ruth Hoffman-2 wrote:
>> 
>> Hi Chris:
>> I guess I'm just use to the inconvenience. :-( The other thing I do to 
>> try and minimize restart time is to comment out the components I might 
>> not be using.
>> Ruth
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p25019021.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: is compile and ofbiz restart still needed for java changes?

Posted by Ruth Hoffman <rh...@aesolves.com>.
Hi Bob:
Yes, I forgot. Its been a while since I've done any hardcore 
development. I also write as much of what I can in the Bean Shell (I 
haven't converted to Groovy yet. :-( Once I get things working, I 
convert to Java. That does save lots of time :-)
Ruth
Bob Morley wrote:
> We typically execute Ofbiz from Eclipse and some people have reported that
> the hot-swapping works fairly well.  (Usually we do not run an ant build
> until right before check-in and then just to ensure we are compiling and
> avoiding classpath issues).
>
> The approach I often take is to write my unit test in conjunction with the
> service implementation I am working on.  I have added some mocking
> capabilities in our Ofbiz installation, so I can avoid starting up the
> container at all and still exercise all of the logic in the service method. 
> Result is usually a sub-second unit test.  Naturally an integration test
> would require container start-up and a reasonably heavy penalty.
>
> Another approach others have used is to write the service method in groovy
> and once working convert this into java.  From memory there is really only a
> single sample of a groovy implemented service, and when I went to do there
> there was at least one bug I had to resolve.  But this is a feasible way and
> the groovy is quite a bit like java.  :)
>
> - Bob
>
>
> Ruth Hoffman-2 wrote:
>   
>> Hi Chris:
>> I guess I'm just use to the inconvenience. :-( The other thing I do to 
>> try and minimize restart time is to comment out the components I might 
>> not be using.
>> Ruth
>>
>>     
>
>   


Re: is compile and ofbiz restart still needed for java changes?

Posted by Bob Morley <rm...@emforium.com>.
We typically execute Ofbiz from Eclipse and some people have reported that
the hot-swapping works fairly well.  (Usually we do not run an ant build
until right before check-in and then just to ensure we are compiling and
avoiding classpath issues).

The approach I often take is to write my unit test in conjunction with the
service implementation I am working on.  I have added some mocking
capabilities in our Ofbiz installation, so I can avoid starting up the
container at all and still exercise all of the logic in the service method. 
Result is usually a sub-second unit test.  Naturally an integration test
would require container start-up and a reasonably heavy penalty.

Another approach others have used is to write the service method in groovy
and once working convert this into java.  From memory there is really only a
single sample of a groovy implemented service, and when I went to do there
there was at least one bug I had to resolve.  But this is a feasible way and
the groovy is quite a bit like java.  :)

- Bob


Ruth Hoffman-2 wrote:
> 
> Hi Chris:
> I guess I'm just use to the inconvenience. :-( The other thing I do to 
> try and minimize restart time is to comment out the components I might 
> not be using.
> Ruth
> 

-- 
View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p25018438.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: is compile and ofbiz restart still needed for java changes?

Posted by Ruth Hoffman <rh...@aesolves.com>.
Hi Chris:
I guess I'm just use to the inconvenience. :-( The other thing I do to 
try and minimize restart time is to comment out the components I might 
not be using.
Ruth
snowc wrote:
> Hi Ruth - I am compiling at the component level.
>
>
> Ruth Hoffman-2 wrote:
>   
>> Hi Jacques:
>> True, but I have found that many times Java is the preferable way to go. 
>> That said, I wonder, Chris, are you building (running ant) at the 
>> component level? If so, then I wonder why it would take that long. If 
>> you build at the root level, yes, that is a pain. But locally in the 
>> component...that, to me is worth the small amount of time it takes build 
>> and restart.
>> Just my 2 cents.
>> Ruth
>> Jacques Le Roux wrote:
>>     
>>> OFBiz has been conceived with this idea in mind. I mean reducing the 
>>> need to restart the server. That's one of the reason why the minilang 
>>> exists...
>>>
>>> Jacques
>>>
>>> From: "snowc" <ch...@gmail.com>
>>>       
>>>> Although I much prefer editing java over bsh, I keep finding myself 
>>>> using bsh
>>>> over java to overcome the lengthy compile/restart cycle (similar to the
>>>> problem with fat ejb versus thin pojo development).  Is there a way to
>>>> reduce this cycle?
>>>>
>>>>
>>>> jacques.le.roux wrote:
>>>>         
>>>>> As long as you modify Java code, you will still need to compile, 
>>>>> hence to
>>>>> stop and restart the server (else you get a conflict on
>>>>> jars used when compiling)
>>>>>
>>>>> Jacques
>>>>>
>>>>> From: "snowc" <ch...@gmail.com>
>>>>>           
>>>>>> Everytime I make a change to java code, I run "ant" and then 
>>>>>> restart the
>>>>>> ofbiz service to pick up the changes.
>>>>>>
>>>>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html 
>>>>>>
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>             
>>>>>
>>>>>
>>>>>           
>>>> -- 
>>>> View this message in context: 
>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>         
>>>
>>>       
>>
>>     
>
>   


Re: is compile and ofbiz restart still needed for java changes?

Posted by snowc <ch...@gmail.com>.
Hi Ruth - I am compiling at the component level.


Ruth Hoffman-2 wrote:
> 
> Hi Jacques:
> True, but I have found that many times Java is the preferable way to go. 
> That said, I wonder, Chris, are you building (running ant) at the 
> component level? If so, then I wonder why it would take that long. If 
> you build at the root level, yes, that is a pain. But locally in the 
> component...that, to me is worth the small amount of time it takes build 
> and restart.
> Just my 2 cents.
> Ruth
> Jacques Le Roux wrote:
>> OFBiz has been conceived with this idea in mind. I mean reducing the 
>> need to restart the server. That's one of the reason why the minilang 
>> exists...
>>
>> Jacques
>>
>> From: "snowc" <ch...@gmail.com>
>>> Although I much prefer editing java over bsh, I keep finding myself 
>>> using bsh
>>> over java to overcome the lengthy compile/restart cycle (similar to the
>>> problem with fat ejb versus thin pojo development).  Is there a way to
>>> reduce this cycle?
>>>
>>>
>>> jacques.le.roux wrote:
>>>>
>>>> As long as you modify Java code, you will still need to compile, 
>>>> hence to
>>>> stop and restart the server (else you get a conflict on
>>>> jars used when compiling)
>>>>
>>>> Jacques
>>>>
>>>> From: "snowc" <ch...@gmail.com>
>>>>>
>>>>> Everytime I make a change to java code, I run "ant" and then 
>>>>> restart the
>>>>> ofbiz service to pick up the changes.
>>>>>
>>>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>>>> -- 
>>>>> View this message in context:
>>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html 
>>>>>
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context: 
>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html 
>>>
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p25005031.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: is compile and ofbiz restart still needed for java changes?

Posted by Ruth Hoffman <rh...@aesolves.com>.
Hi Jacques:
True, but I have found that many times Java is the preferable way to go. 
That said, I wonder, Chris, are you building (running ant) at the 
component level? If so, then I wonder why it would take that long. If 
you build at the root level, yes, that is a pain. But locally in the 
component...that, to me is worth the small amount of time it takes build 
and restart.
Just my 2 cents.
Ruth
Jacques Le Roux wrote:
> OFBiz has been conceived with this idea in mind. I mean reducing the 
> need to restart the server. That's one of the reason why the minilang 
> exists...
>
> Jacques
>
> From: "snowc" <ch...@gmail.com>
>> Although I much prefer editing java over bsh, I keep finding myself 
>> using bsh
>> over java to overcome the lengthy compile/restart cycle (similar to the
>> problem with fat ejb versus thin pojo development).  Is there a way to
>> reduce this cycle?
>>
>>
>> jacques.le.roux wrote:
>>>
>>> As long as you modify Java code, you will still need to compile, 
>>> hence to
>>> stop and restart the server (else you get a conflict on
>>> jars used when compiling)
>>>
>>> Jacques
>>>
>>> From: "snowc" <ch...@gmail.com>
>>>>
>>>> Everytime I make a change to java code, I run "ant" and then 
>>>> restart the
>>>> ofbiz service to pick up the changes.
>>>>
>>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html 
>>>>
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html 
>>
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>
>
>


Re: is compile and ofbiz restart still needed for java changes?

Posted by Jacques Le Roux <ja...@les7arts.com>.
OFBiz has been conceived with this idea in mind. I mean reducing the need to restart the server. That's one of the reason why the 
minilang exists...

Jacques

From: "snowc" <ch...@gmail.com>
> Although I much prefer editing java over bsh, I keep finding myself using bsh
> over java to overcome the lengthy compile/restart cycle (similar to the
> problem with fat ejb versus thin pojo development).  Is there a way to
> reduce this cycle?
>
>
> jacques.le.roux wrote:
>>
>> As long as you modify Java code, you will still need to compile, hence to
>> stop and restart the server (else you get a conflict on
>> jars used when compiling)
>>
>> Jacques
>>
>> From: "snowc" <ch...@gmail.com>
>>>
>>> Everytime I make a change to java code, I run "ant" and then restart the
>>> ofbiz service to pick up the changes.
>>>
>>> Is this still necessary?  I am running r4.0.  What about 9.04
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>>
>
> -- 
> View this message in context: 
> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
> 



Re: is compile and ofbiz restart still needed for java changes?

Posted by snowc <ch...@gmail.com>.
Although I much prefer editing java over bsh, I keep finding myself using bsh
over java to overcome the lengthy compile/restart cycle (similar to the
problem with fat ejb versus thin pojo development).  Is there a way to
reduce this cycle?


jacques.le.roux wrote:
> 
> As long as you modify Java code, you will still need to compile, hence to
> stop and restart the server (else you get a conflict on 
> jars used when compiling)
> 
> Jacques
> 
> From: "snowc" <ch...@gmail.com>
>>
>> Everytime I make a change to java code, I run "ant" and then restart the
>> ofbiz service to pick up the changes.
>>
>> Is this still necessary?  I am running r4.0.  What about 9.04
>> -- 
>> View this message in context: 
>> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971811.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: is compile and ofbiz restart still needed for java changes?

Posted by Jacques Le Roux <ja...@les7arts.com>.
As long as you modify Java code, you will still need to compile, hence to stop and restart the server (else you get a conflict on 
jars used when compiling)

Jacques

From: "snowc" <ch...@gmail.com>
>
> Everytime I make a change to java code, I run "ant" and then restart the
> ofbiz service to pick up the changes.
>
> Is this still necessary?  I am running r4.0.  What about 9.04
> -- 
> View this message in context: 
> http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p24971472.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>