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/07/19 08:20:45 UTC

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

Author: taher
Date: Tue Jul 19 08:20:45 2016
New Revision: 1753348

URL: http://svn.apache.org/viewvc?rev=1753348&view=rev
Log:
Break down the tests of requestStatus and requestShutdown - OFBIZ-7897

The two tests were lumped together and if one throws an exception the other
will never throw it. So test coverage was not done properly. This commit
fixes this issue by separating the calls into two different tests.

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=1753348&r1=1753347&r2=1753348&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 Jul 19 08:20:45 2016
@@ -70,14 +70,21 @@ public class OfbizStartupUnitTests {
     }
 
     @Test
-    public void adminClientReturnsTheCorrectMessageIfServerIsDown() throws StartupException {
-        assertThat(sendRequestToAdminClient("--status"), equalTo("OFBiz is Down"));
-        assertThat(sendRequestToAdminClient("--shutdown"), equalTo("OFBiz is Down"));
+    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 String sendRequestToAdminClient(String request) throws StartupException {
+    private Config sendRequestToAdminClient(String request) throws StartupException {
         List<StartupCommand> startupCommands = StartupCommandUtil.parseOfbizCommands(new String[]{request});
-        Config config = new Config(startupCommands);
-        return AdminClient.requestStatus(config);
+        return new Config(startupCommands);
     }
 }



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

Posted by Suraj Khurana <su...@hotwaxsystems.com>.
Yes, working fine for on latest rev.
Here are the logs, I think I was on rev #*1753362* that time.

*{quote}*
suraj@suraj-desktop:~/sandbox/ofbiz_trunk$ ./gradlew cleanAll
:clean
:cleanCatalina
:cleanData
:cleanDownloads
:cleanEclipseClasspath
:cleanEclipseJdt UP-TO-DATE
:cleanEclipseProject
:cleanEclipse
:cleanGradle
:cleanIndexes
:cleanLogs
:cleanOutput
:cleanTempfiles
:cleanUploads
:cleanXtra
:cleanAll

BUILD SUCCESSFUL

Total time: 10.687 secs

This build could be faster, please consider using the Gradle Daemon:
https://docs.gradle.org/2.13/userguide/gradle_daemon.html
suraj@suraj-desktop:~/sandbox/ofbiz_trunk$ ./gradlew loadDefault
:compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:createBaseTestServiceProviderJar
:processResources
:classes
:jar
:assemble
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test

org.apache.ofbiz.base.start.OfbizStartupUnitTests >
adminClientReturnsTheCorrectMessageIfServerIsDownOnStatus FAILED
    java.lang.AssertionError at OfbizStartupUnitTests.java:76

org.apache.ofbiz.base.start.OfbizStartupUnitTests >
adminClientReturnsTheCorrectMessageIfServerIsDownOnShutdown FAILED
    java.lang.AssertionError at OfbizStartupUnitTests.java:83

9 tests completed, 2 failed
:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at:
file:///home/suraj/sandbox/ofbiz_trunk/build/reports/tests/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.

BUILD FAILED

Total time: 43.321 secs

*{quote}*


Suraj Khurana
Enterprise Software Engineer
HotWax Systems <http://www.hotwaxsystems.com/> - *The global leader in
innovative enterprise commerce solutions **powered by Apache OFBiz.*
<https://about.me/surajkhurana?promo=email_sig>


On Tue, Jul 19, 2016 at 5:33 PM, Nicolas Malin <ni...@nereide.fr>
wrote:

> $ svn up && ./gradlew cleanAll build
>
> works also fine for me
>
>
> Le 19/07/2016 13:58, Taher Alkhateeb a écrit :
>
>> Hi Suraj,
>>
>> The system is building fine on my computer. And you don't need an import
>> because you are on the same package. Maybe something is wrong in your
>> environment?
>>
>> Regards,
>>
>> Taher Alkhateeb
>>
>> On Tue, Jul 19, 2016 at 2:52 PM, Suraj Khurana <
>> suraj.khurana@hotwaxsystems.com> wrote:
>>
>> Hello Taher,
>>>
>>> This is causing build fail. I think this  is due to a missing import.
>>>
>>> "*import org.apache.ofbiz.base.start.AdminClient;*"
>>>
>>> --
>>> Thanks and Regards,
>>> Suraj Khurana
>>> Enterprise Software Engineer
>>> HotWax Systems <http://www.hotwaxsystems.com/> - *The global leader in
>>> innovative enterprise commerce solutions **powered by Apache OFBiz.*
>>> <https://about.me/surajkhurana?promo=email_sig>
>>>
>>>
>>> On Tue, Jul 19, 2016 at 1:50 PM, <ta...@apache.org> wrote:
>>>
>>> Author: taher
>>>> Date: Tue Jul 19 08:20:45 2016
>>>> New Revision: 1753348
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1753348&view=rev
>>>> Log:
>>>> Break down the tests of requestStatus and requestShutdown - OFBIZ-7897
>>>>
>>>> The two tests were lumped together and if one throws an exception the
>>>>
>>> other
>>>
>>>> will never throw it. So test coverage was not done properly. This commit
>>>> fixes this issue by separating the calls into two different tests.
>>>>
>>>> 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=1753348&r1=1753347&r2=1753348&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 Jul 19 08:20:45 2016
>>>> @@ -70,14 +70,21 @@ public class OfbizStartupUnitTests {
>>>>       }
>>>>
>>>>       @Test
>>>> -    public void adminClientReturnsTheCorrectMessageIfServerIsDown()
>>>> throws StartupException {
>>>> -        assertThat(sendRequestToAdminClient("--status"), equalTo("OFBiz
>>>> is Down"));
>>>> -        assertThat(sendRequestToAdminClient("--shutdown"),
>>>>
>>> equalTo("OFBiz
>>>
>>>> is Down"));
>>>> +    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 String sendRequestToAdminClient(String request) throws
>>>> StartupException {
>>>> +    private Config sendRequestToAdminClient(String request) throws
>>>> StartupException {
>>>>           List<StartupCommand> startupCommands =
>>>> StartupCommandUtil.parseOfbizCommands(new String[]{request});
>>>> -        Config config = new Config(startupCommands);
>>>> -        return AdminClient.requestStatus(config);
>>>> +        return new Config(startupCommands);
>>>>       }
>>>>   }
>>>>
>>>>
>>>>
>>>>
>

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

Posted by Nicolas Malin <ni...@nereide.fr>.
$ svn up && ./gradlew cleanAll build

works also fine for me

Le 19/07/2016 13:58, Taher Alkhateeb a �crit :
> Hi Suraj,
>
> The system is building fine on my computer. And you don't need an import
> because you are on the same package. Maybe something is wrong in your
> environment?
>
> Regards,
>
> Taher Alkhateeb
>
> On Tue, Jul 19, 2016 at 2:52 PM, Suraj Khurana <
> suraj.khurana@hotwaxsystems.com> wrote:
>
>> Hello Taher,
>>
>> This is causing build fail. I think this  is due to a missing import.
>>
>> "*import org.apache.ofbiz.base.start.AdminClient;*"
>>
>> --
>> Thanks and Regards,
>> Suraj Khurana
>> Enterprise Software Engineer
>> HotWax Systems <http://www.hotwaxsystems.com/> - *The global leader in
>> innovative enterprise commerce solutions **powered by Apache OFBiz.*
>> <https://about.me/surajkhurana?promo=email_sig>
>>
>>
>> On Tue, Jul 19, 2016 at 1:50 PM, <ta...@apache.org> wrote:
>>
>>> Author: taher
>>> Date: Tue Jul 19 08:20:45 2016
>>> New Revision: 1753348
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1753348&view=rev
>>> Log:
>>> Break down the tests of requestStatus and requestShutdown - OFBIZ-7897
>>>
>>> The two tests were lumped together and if one throws an exception the
>> other
>>> will never throw it. So test coverage was not done properly. This commit
>>> fixes this issue by separating the calls into two different tests.
>>>
>>> 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=1753348&r1=1753347&r2=1753348&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 Jul 19 08:20:45 2016
>>> @@ -70,14 +70,21 @@ public class OfbizStartupUnitTests {
>>>       }
>>>
>>>       @Test
>>> -    public void adminClientReturnsTheCorrectMessageIfServerIsDown()
>>> throws StartupException {
>>> -        assertThat(sendRequestToAdminClient("--status"), equalTo("OFBiz
>>> is Down"));
>>> -        assertThat(sendRequestToAdminClient("--shutdown"),
>> equalTo("OFBiz
>>> is Down"));
>>> +    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 String sendRequestToAdminClient(String request) throws
>>> StartupException {
>>> +    private Config sendRequestToAdminClient(String request) throws
>>> StartupException {
>>>           List<StartupCommand> startupCommands =
>>> StartupCommandUtil.parseOfbizCommands(new String[]{request});
>>> -        Config config = new Config(startupCommands);
>>> -        return AdminClient.requestStatus(config);
>>> +        return new Config(startupCommands);
>>>       }
>>>   }
>>>
>>>
>>>


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

Posted by Taher Alkhateeb <sl...@gmail.com>.
Hi Suraj,

The system is building fine on my computer. And you don't need an import
because you are on the same package. Maybe something is wrong in your
environment?

Regards,

Taher Alkhateeb

On Tue, Jul 19, 2016 at 2:52 PM, Suraj Khurana <
suraj.khurana@hotwaxsystems.com> wrote:

> Hello Taher,
>
> This is causing build fail. I think this  is due to a missing import.
>
> "*import org.apache.ofbiz.base.start.AdminClient;*"
>
> --
> Thanks and Regards,
> Suraj Khurana
> Enterprise Software Engineer
> HotWax Systems <http://www.hotwaxsystems.com/> - *The global leader in
> innovative enterprise commerce solutions **powered by Apache OFBiz.*
> <https://about.me/surajkhurana?promo=email_sig>
>
>
> On Tue, Jul 19, 2016 at 1:50 PM, <ta...@apache.org> wrote:
>
> > Author: taher
> > Date: Tue Jul 19 08:20:45 2016
> > New Revision: 1753348
> >
> > URL: http://svn.apache.org/viewvc?rev=1753348&view=rev
> > Log:
> > Break down the tests of requestStatus and requestShutdown - OFBIZ-7897
> >
> > The two tests were lumped together and if one throws an exception the
> other
> > will never throw it. So test coverage was not done properly. This commit
> > fixes this issue by separating the calls into two different tests.
> >
> > 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=1753348&r1=1753347&r2=1753348&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 Jul 19 08:20:45 2016
> > @@ -70,14 +70,21 @@ public class OfbizStartupUnitTests {
> >      }
> >
> >      @Test
> > -    public void adminClientReturnsTheCorrectMessageIfServerIsDown()
> > throws StartupException {
> > -        assertThat(sendRequestToAdminClient("--status"), equalTo("OFBiz
> > is Down"));
> > -        assertThat(sendRequestToAdminClient("--shutdown"),
> equalTo("OFBiz
> > is Down"));
> > +    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 String sendRequestToAdminClient(String request) throws
> > StartupException {
> > +    private Config sendRequestToAdminClient(String request) throws
> > StartupException {
> >          List<StartupCommand> startupCommands =
> > StartupCommandUtil.parseOfbizCommands(new String[]{request});
> > -        Config config = new Config(startupCommands);
> > -        return AdminClient.requestStatus(config);
> > +        return new Config(startupCommands);
> >      }
> >  }
> >
> >
> >
>

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

Posted by Suraj Khurana <su...@hotwaxsystems.com>.
Hello Taher,

This is causing build fail. I think this  is due to a missing import.

"*import org.apache.ofbiz.base.start.AdminClient;*"

--
Thanks and Regards,
Suraj Khurana
Enterprise Software Engineer
HotWax Systems <http://www.hotwaxsystems.com/> - *The global leader in
innovative enterprise commerce solutions **powered by Apache OFBiz.*
<https://about.me/surajkhurana?promo=email_sig>


On Tue, Jul 19, 2016 at 1:50 PM, <ta...@apache.org> wrote:

> Author: taher
> Date: Tue Jul 19 08:20:45 2016
> New Revision: 1753348
>
> URL: http://svn.apache.org/viewvc?rev=1753348&view=rev
> Log:
> Break down the tests of requestStatus and requestShutdown - OFBIZ-7897
>
> The two tests were lumped together and if one throws an exception the other
> will never throw it. So test coverage was not done properly. This commit
> fixes this issue by separating the calls into two different tests.
>
> 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=1753348&r1=1753347&r2=1753348&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 Jul 19 08:20:45 2016
> @@ -70,14 +70,21 @@ public class OfbizStartupUnitTests {
>      }
>
>      @Test
> -    public void adminClientReturnsTheCorrectMessageIfServerIsDown()
> throws StartupException {
> -        assertThat(sendRequestToAdminClient("--status"), equalTo("OFBiz
> is Down"));
> -        assertThat(sendRequestToAdminClient("--shutdown"), equalTo("OFBiz
> is Down"));
> +    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 String sendRequestToAdminClient(String request) throws
> StartupException {
> +    private Config sendRequestToAdminClient(String request) throws
> StartupException {
>          List<StartupCommand> startupCommands =
> StartupCommandUtil.parseOfbizCommands(new String[]{request});
> -        Config config = new Config(startupCommands);
> -        return AdminClient.requestStatus(config);
> +        return new Config(startupCommands);
>      }
>  }
>
>
>