You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ta...@apache.org on 2016/08/23 11:42:21 UTC

svn commit: r1757360 - /ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java

Author: taher
Date: Tue Aug 23 11:42:21 2016
New Revision: 1757360

URL: http://svn.apache.org/viewvc?rev=1757360&view=rev
Log:
remove unit tests from the start component that cause a regression - OFBIZ-7897

There were two tests in the start component that have a hidden regression which
can be repeated as follows:

- start ofbiz with a normal ./gradlew "ofbiz --start"
- Make some changes to the code
- stop ofbiz with ./gradlew "ofbiz --shutdown"

OFBiz will fail to stop because the unit tests will fail due to changed code
while OFBiz is still active.

The correct solution is to convert these tests to integration tests and handle the different
scenarios while the AdminServer is up.

Modified:
    ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java

Modified: ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java?rev=1757360&r1=1757359&r2=1757360&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java (original)
+++ ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java Tue Aug 23 11:42:21 2016
@@ -68,23 +68,4 @@ public class OfbizStartupUnitTests {
         assertThat(startupCommands.size(), equalTo(1));
         assertThat(startupCommands.get(0).getProperties().size(), equalTo(3));
     }
-
-    @Test
-    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnStatus() throws StartupException {
-        Config config = sendRequestToAdminClient("--status");
-
-        assertThat(AdminClient.requestStatus(config), equalTo("OFBiz is Down"));
-    }
-
-    @Test
-    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnShutdown() throws StartupException {
-        Config config = sendRequestToAdminClient("--shutdown");
-
-        assertThat(AdminClient.requestShutdown(config), equalTo("OFBiz is Down"));
-    }
-
-    private Config sendRequestToAdminClient(String request) throws StartupException {
-        List<StartupCommand> startupCommands = StartupCommandUtil.parseOfbizCommands(new String[]{request});
-        return new Config(startupCommands);
-    }
 }



Re: svn commit: r1757360 - /ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/Ofbi zStartupUnitTests.java

Posted by Taher Alkhateeb <sl...@gmail.com>.
There are two scenarios:
1- if you do not change the code, the build task is skipped
2- if you do change the code, the build task executes

Both scenarios above are the "right" thing to do whether in a test or a
production environment. This also adds comfort and ease of use to the users
given that OFBiz heavily depends on gradle for resolution of dependencies,
build up of classpath, and other automations. Ideally you always depend on
the build system to take care of everything. If, on the other hand, you
need special deployment requirements, then it is very trivial to cut the
dependency, it is literally by removing 6 characters from build.gradle.

On Tue, Aug 23, 2016 at 3:09 PM, Pierre Smits <pi...@gmail.com>
wrote:

> Yes it does.
>
> But not in production environments. Calling and executing build tasks on a
> production system is introducing unnecessary business risks.
>
> Best regards,
>
> Pierre Smits
>
> ORRTIZ.COM <http://www.orrtiz.com>
> OFBiz based solutions & services
>
> OFBiz Extensions Marketplace
> http://oem.ofbizci.net/oci-2/
>
> On Tue, Aug 23, 2016 at 1:59 PM, Jacques Le Roux <
> jacques.le.roux@les7arts.com> wrote:
>
> > Thanks, no I did not change "some code" (I guess you mean Java)
> >
> > A worry less, I guess it was something else, and terminateOFBiz does the
> > job!
> >
> > Jacques
> >
> >
> >
> > Le 23/08/2016 à 13:53, Taher Alkhateeb a écrit :
> >
> >> I don't know, do you change some code while OFBiz is up? If yes then
> >> probably that is the reason. If not then it could be something else.
> >>
> >> On Tue, Aug 23, 2016 at 2:51 PM, Jacques Le Roux <
> >> jacques.le.roux@les7arts.com> wrote:
> >>
> >> Could it be the reason I had to switch to terminateOFBiz at some point
> for
> >>> trunk demo?
> >>>
> >>> Thanks
> >>>
> >>> Jacques
> >>>
> >>>
> >>>
> >>> Le 23/08/2016 à 13:42, taher@apache.org a écrit :
> >>>
> >>> Author: taher
> >>>> Date: Tue Aug 23 11:42:21 2016
> >>>> New Revision: 1757360
> >>>>
> >>>> URL: http://svn.apache.org/viewvc?rev=1757360&view=rev
> >>>> Log:
> >>>> remove unit tests from the start component that cause a regression -
> >>>> OFBIZ-7897
> >>>>
> >>>> There were two tests in the start component that have a hidden
> >>>> regression
> >>>> which
> >>>> can be repeated as follows:
> >>>>
> >>>> - start ofbiz with a normal ./gradlew "ofbiz --start"
> >>>> - Make some changes to the code
> >>>> - stop ofbiz with ./gradlew "ofbiz --shutdown"
> >>>>
> >>>> OFBiz will fail to stop because the unit tests will fail due to
> changed
> >>>> code
> >>>> while OFBiz is still active.
> >>>>
> >>>> The correct solution is to convert these tests to integration tests
> and
> >>>> handle the different
> >>>> scenarios while the AdminServer is up.
> >>>>
> >>>> Modified:
> >>>>       ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
> >>>> base/start/OfbizStartupUnitTests.java
> >>>>
> >>>> Modified: ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
> >>>> base/start/OfbizStartupUnitTests.java
> >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src
> >>>> /test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTes
> >>>> ts.java?rev=1757360&r1=1757359&r2=1757360&view=diff
> >>>> ============================================================
> >>>> ==================
> >>>> --- ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
> >>>> base/start/OfbizStartupUnitTests.java (original)
> >>>> +++ ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
> >>>> base/start/OfbizStartupUnitTests.java Tue Aug 23 11:42:21 2016
> >>>> @@ -68,23 +68,4 @@ public class OfbizStartupUnitTests {
> >>>>            assertThat(startupCommands.size(), equalTo(1));
> >>>>            assertThat(startupCommands.get(0).getProperties().size(),
> >>>> equalTo(3));
> >>>>        }
> >>>> -
> >>>> -    @Test
> >>>> -    public void adminClientReturnsTheCorrectMe
> >>>> ssageIfServerIsDownOnStatus()
> >>>> throws StartupException {
> >>>> -        Config config = sendRequestToAdminClient("--status");
> >>>> -
> >>>> -        assertThat(AdminClient.requestStatus(config), equalTo("OFBiz
> >>>> is
> >>>> Down"));
> >>>> -    }
> >>>> -
> >>>> -    @Test
> >>>> -    public void adminClientReturnsTheCorrectMe
> >>>> ssageIfServerIsDownOnShutdown() throws StartupException {
> >>>> -        Config config = sendRequestToAdminClient("--shutdown");
> >>>> -
> >>>> -        assertThat(AdminClient.requestShutdown(config),
> equalTo("OFBiz
> >>>> is Down"));
> >>>> -    }
> >>>> -
> >>>> -    private Config sendRequestToAdminClient(String request) throws
> >>>> StartupException {
> >>>> -        List<StartupCommand> startupCommands =
> >>>> StartupCommandUtil.parseOfbizCommands(new String[]{request});
> >>>> -        return new Config(startupCommands);
> >>>> -    }
> >>>>    }
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >
>

Re: svn commit: r1757360 - /ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/Ofbi zStartupUnitTests.java

Posted by Pierre Smits <pi...@gmail.com>.
Yes it does.

But not in production environments. Calling and executing build tasks on a
production system is introducing unnecessary business risks.

Best regards,

Pierre Smits

ORRTIZ.COM <http://www.orrtiz.com>
OFBiz based solutions & services

OFBiz Extensions Marketplace
http://oem.ofbizci.net/oci-2/

On Tue, Aug 23, 2016 at 1:59 PM, Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> Thanks, no I did not change "some code" (I guess you mean Java)
>
> A worry less, I guess it was something else, and terminateOFBiz does the
> job!
>
> Jacques
>
>
>
> Le 23/08/2016 à 13:53, Taher Alkhateeb a écrit :
>
>> I don't know, do you change some code while OFBiz is up? If yes then
>> probably that is the reason. If not then it could be something else.
>>
>> On Tue, Aug 23, 2016 at 2:51 PM, Jacques Le Roux <
>> jacques.le.roux@les7arts.com> wrote:
>>
>> Could it be the reason I had to switch to terminateOFBiz at some point for
>>> trunk demo?
>>>
>>> Thanks
>>>
>>> Jacques
>>>
>>>
>>>
>>> Le 23/08/2016 à 13:42, taher@apache.org a écrit :
>>>
>>> Author: taher
>>>> Date: Tue Aug 23 11:42:21 2016
>>>> New Revision: 1757360
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1757360&view=rev
>>>> Log:
>>>> remove unit tests from the start component that cause a regression -
>>>> OFBIZ-7897
>>>>
>>>> There were two tests in the start component that have a hidden
>>>> regression
>>>> which
>>>> can be repeated as follows:
>>>>
>>>> - start ofbiz with a normal ./gradlew "ofbiz --start"
>>>> - Make some changes to the code
>>>> - stop ofbiz with ./gradlew "ofbiz --shutdown"
>>>>
>>>> OFBiz will fail to stop because the unit tests will fail due to changed
>>>> code
>>>> while OFBiz is still active.
>>>>
>>>> The correct solution is to convert these tests to integration tests and
>>>> handle the different
>>>> scenarios while the AdminServer is up.
>>>>
>>>> Modified:
>>>>       ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>>> base/start/OfbizStartupUnitTests.java
>>>>
>>>> Modified: ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>>> base/start/OfbizStartupUnitTests.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src
>>>> /test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTes
>>>> ts.java?rev=1757360&r1=1757359&r2=1757360&view=diff
>>>> ============================================================
>>>> ==================
>>>> --- ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>>> base/start/OfbizStartupUnitTests.java (original)
>>>> +++ ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>>> base/start/OfbizStartupUnitTests.java Tue Aug 23 11:42:21 2016
>>>> @@ -68,23 +68,4 @@ public class OfbizStartupUnitTests {
>>>>            assertThat(startupCommands.size(), equalTo(1));
>>>>            assertThat(startupCommands.get(0).getProperties().size(),
>>>> equalTo(3));
>>>>        }
>>>> -
>>>> -    @Test
>>>> -    public void adminClientReturnsTheCorrectMe
>>>> ssageIfServerIsDownOnStatus()
>>>> throws StartupException {
>>>> -        Config config = sendRequestToAdminClient("--status");
>>>> -
>>>> -        assertThat(AdminClient.requestStatus(config), equalTo("OFBiz
>>>> is
>>>> Down"));
>>>> -    }
>>>> -
>>>> -    @Test
>>>> -    public void adminClientReturnsTheCorrectMe
>>>> ssageIfServerIsDownOnShutdown() throws StartupException {
>>>> -        Config config = sendRequestToAdminClient("--shutdown");
>>>> -
>>>> -        assertThat(AdminClient.requestShutdown(config), equalTo("OFBiz
>>>> is Down"));
>>>> -    }
>>>> -
>>>> -    private Config sendRequestToAdminClient(String request) throws
>>>> StartupException {
>>>> -        List<StartupCommand> startupCommands =
>>>> StartupCommandUtil.parseOfbizCommands(new String[]{request});
>>>> -        return new Config(startupCommands);
>>>> -    }
>>>>    }
>>>>
>>>>
>>>>
>>>>
>>>>
>

Re: svn commit: r1757360 - /ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/Ofbi zStartupUnitTests.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks, no I did not change "some code" (I guess you mean Java)

A worry less, I guess it was something else, and terminateOFBiz does the job!

Jacques


Le 23/08/2016 � 13:53, Taher Alkhateeb a �crit :
> I don't know, do you change some code while OFBiz is up? If yes then
> probably that is the reason. If not then it could be something else.
>
> On Tue, Aug 23, 2016 at 2:51 PM, Jacques Le Roux <
> jacques.le.roux@les7arts.com> wrote:
>
>> Could it be the reason I had to switch to terminateOFBiz at some point for
>> trunk demo?
>>
>> Thanks
>>
>> Jacques
>>
>>
>>
>> Le 23/08/2016 � 13:42, taher@apache.org a �crit :
>>
>>> Author: taher
>>> Date: Tue Aug 23 11:42:21 2016
>>> New Revision: 1757360
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1757360&view=rev
>>> Log:
>>> remove unit tests from the start component that cause a regression -
>>> OFBIZ-7897
>>>
>>> There were two tests in the start component that have a hidden regression
>>> which
>>> can be repeated as follows:
>>>
>>> - start ofbiz with a normal ./gradlew "ofbiz --start"
>>> - Make some changes to the code
>>> - stop ofbiz with ./gradlew "ofbiz --shutdown"
>>>
>>> OFBiz will fail to stop because the unit tests will fail due to changed
>>> code
>>> while OFBiz is still active.
>>>
>>> The correct solution is to convert these tests to integration tests and
>>> handle the different
>>> scenarios while the AdminServer is up.
>>>
>>> Modified:
>>>       ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>> base/start/OfbizStartupUnitTests.java
>>>
>>> Modified: ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>> base/start/OfbizStartupUnitTests.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src
>>> /test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTes
>>> ts.java?rev=1757360&r1=1757359&r2=1757360&view=diff
>>> ============================================================
>>> ==================
>>> --- ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>> base/start/OfbizStartupUnitTests.java (original)
>>> +++ ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>>> base/start/OfbizStartupUnitTests.java Tue Aug 23 11:42:21 2016
>>> @@ -68,23 +68,4 @@ public class OfbizStartupUnitTests {
>>>            assertThat(startupCommands.size(), equalTo(1));
>>>            assertThat(startupCommands.get(0).getProperties().size(),
>>> equalTo(3));
>>>        }
>>> -
>>> -    @Test
>>> -    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnStatus()
>>> throws StartupException {
>>> -        Config config = sendRequestToAdminClient("--status");
>>> -
>>> -        assertThat(AdminClient.requestStatus(config), equalTo("OFBiz is
>>> Down"));
>>> -    }
>>> -
>>> -    @Test
>>> -    public void adminClientReturnsTheCorrectMe
>>> ssageIfServerIsDownOnShutdown() throws StartupException {
>>> -        Config config = sendRequestToAdminClient("--shutdown");
>>> -
>>> -        assertThat(AdminClient.requestShutdown(config), equalTo("OFBiz
>>> is Down"));
>>> -    }
>>> -
>>> -    private Config sendRequestToAdminClient(String request) throws
>>> StartupException {
>>> -        List<StartupCommand> startupCommands =
>>> StartupCommandUtil.parseOfbizCommands(new String[]{request});
>>> -        return new Config(startupCommands);
>>> -    }
>>>    }
>>>
>>>
>>>
>>>


Re: svn commit: r1757360 - /ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/Ofbi zStartupUnitTests.java

Posted by Taher Alkhateeb <sl...@gmail.com>.
I don't know, do you change some code while OFBiz is up? If yes then
probably that is the reason. If not then it could be something else.

On Tue, Aug 23, 2016 at 2:51 PM, Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> Could it be the reason I had to switch to terminateOFBiz at some point for
> trunk demo?
>
> Thanks
>
> Jacques
>
>
>
> Le 23/08/2016 à 13:42, taher@apache.org a écrit :
>
>> Author: taher
>> Date: Tue Aug 23 11:42:21 2016
>> New Revision: 1757360
>>
>> URL: http://svn.apache.org/viewvc?rev=1757360&view=rev
>> Log:
>> remove unit tests from the start component that cause a regression -
>> OFBIZ-7897
>>
>> There were two tests in the start component that have a hidden regression
>> which
>> can be repeated as follows:
>>
>> - start ofbiz with a normal ./gradlew "ofbiz --start"
>> - Make some changes to the code
>> - stop ofbiz with ./gradlew "ofbiz --shutdown"
>>
>> OFBiz will fail to stop because the unit tests will fail due to changed
>> code
>> while OFBiz is still active.
>>
>> The correct solution is to convert these tests to integration tests and
>> handle the different
>> scenarios while the AdminServer is up.
>>
>> Modified:
>>      ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>> base/start/OfbizStartupUnitTests.java
>>
>> Modified: ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>> base/start/OfbizStartupUnitTests.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src
>> /test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTes
>> ts.java?rev=1757360&r1=1757359&r2=1757360&view=diff
>> ============================================================
>> ==================
>> --- ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>> base/start/OfbizStartupUnitTests.java (original)
>> +++ ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/
>> base/start/OfbizStartupUnitTests.java Tue Aug 23 11:42:21 2016
>> @@ -68,23 +68,4 @@ public class OfbizStartupUnitTests {
>>           assertThat(startupCommands.size(), equalTo(1));
>>           assertThat(startupCommands.get(0).getProperties().size(),
>> equalTo(3));
>>       }
>> -
>> -    @Test
>> -    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnStatus()
>> throws StartupException {
>> -        Config config = sendRequestToAdminClient("--status");
>> -
>> -        assertThat(AdminClient.requestStatus(config), equalTo("OFBiz is
>> Down"));
>> -    }
>> -
>> -    @Test
>> -    public void adminClientReturnsTheCorrectMe
>> ssageIfServerIsDownOnShutdown() throws StartupException {
>> -        Config config = sendRequestToAdminClient("--shutdown");
>> -
>> -        assertThat(AdminClient.requestShutdown(config), equalTo("OFBiz
>> is Down"));
>> -    }
>> -
>> -    private Config sendRequestToAdminClient(String request) throws
>> StartupException {
>> -        List<StartupCommand> startupCommands =
>> StartupCommandUtil.parseOfbizCommands(new String[]{request});
>> -        return new Config(startupCommands);
>> -    }
>>   }
>>
>>
>>
>>
>

Re: svn commit: r1757360 - /ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/Ofbi zStartupUnitTests.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
Could it be the reason I had to switch to terminateOFBiz at some point for trunk demo?

Thanks

Jacques


Le 23/08/2016 � 13:42, taher@apache.org a �crit :
> Author: taher
> Date: Tue Aug 23 11:42:21 2016
> New Revision: 1757360
>
> URL: http://svn.apache.org/viewvc?rev=1757360&view=rev
> Log:
> remove unit tests from the start component that cause a regression - OFBIZ-7897
>
> There were two tests in the start component that have a hidden regression which
> can be repeated as follows:
>
> - start ofbiz with a normal ./gradlew "ofbiz --start"
> - Make some changes to the code
> - stop ofbiz with ./gradlew "ofbiz --shutdown"
>
> OFBiz will fail to stop because the unit tests will fail due to changed code
> while OFBiz is still active.
>
> The correct solution is to convert these tests to integration tests and handle the different
> scenarios while the AdminServer is up.
>
> Modified:
>      ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java
>
> Modified: ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java?rev=1757360&r1=1757359&r2=1757360&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java (original)
> +++ ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java Tue Aug 23 11:42:21 2016
> @@ -68,23 +68,4 @@ public class OfbizStartupUnitTests {
>           assertThat(startupCommands.size(), equalTo(1));
>           assertThat(startupCommands.get(0).getProperties().size(), equalTo(3));
>       }
> -
> -    @Test
> -    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnStatus() throws StartupException {
> -        Config config = sendRequestToAdminClient("--status");
> -
> -        assertThat(AdminClient.requestStatus(config), equalTo("OFBiz is Down"));
> -    }
> -
> -    @Test
> -    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnShutdown() throws StartupException {
> -        Config config = sendRequestToAdminClient("--shutdown");
> -
> -        assertThat(AdminClient.requestShutdown(config), equalTo("OFBiz is Down"));
> -    }
> -
> -    private Config sendRequestToAdminClient(String request) throws StartupException {
> -        List<StartupCommand> startupCommands = StartupCommandUtil.parseOfbizCommands(new String[]{request});
> -        return new Config(startupCommands);
> -    }
>   }
>
>
>