You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Hank Bruning <ha...@jblade.com> on 2015/09/19 14:37:35 UTC

toString() hangs

I was writing a test case to get the $metadata and found that a toString()
method never returns. The Java thread stays active and never exits.
Does anyone know why the last four tines of this test case do not work.
What have I done wrong?
Hank

 @Test
    public void getMetaData()
            throws Exception
    {
        ODataClient client = ODataClientFactory.getClient();
        String url = "http://localhost:8080/anyValidURL/$metadata";
        ODataServiceDocumentRequest req =
client.getRetrieveRequestFactory().getServiceDocumentRequest(url);

        req.setFormat(ContentType.APPLICATION_XML);

        ODataRetrieveResponse<ClientServiceDocument> res = req.execute();

        if (res.getStatusCode() == 200)
        {

            System.out.println("Success getting response.");
            // Error below: This never prints.
            System.out.println("response: toString()=" +
res.getBody().toString());
            // You can comment out the line above and uncomment this and it
never prints.
            //  System.out.println("response: getClass()=" +
res.getBody().getClass());
        }
    }

Re: toString() hangs

Posted by Hank Bruning <ha...@jblade.com>.
Michel,
I am using JBoss RESTEasy instead of tomcat to run my tests. I think the
problem must be related to that.
Thanks for the help.
Hank

On Sun, Sep 20, 2015 at 2:22 AM, mibo <mi...@apache.org> wrote:

> Hello Hank,
>
> At first glance I do not see anything you have done wrong.
> However I was not able to reproduce your mentioned behavior.
> I executed the „retrieveServiceDocument“ test method in the
> „org.apache.olingo.fit.base.ServiceDocumentTestITCase“ test class.
> And when I insert an "system out" line:
> 41: final ClientServiceDocument serviceDocument = res.getBody();
> 42: System.out.println(serviceDocument.toString());
> I get the expected output:
> org.apache.olingo.client.api.domain.ClientServiceDocument@45ae9c3f
>
> In what environment (e.g. Tomcat) do you run what type of service (e.g.
> Olingo Test Server „tecsvc“)?
>
> Best Regards,
> Michael
>
> > Am 19.09.2015 um 14:37 schrieb Hank Bruning <ha...@jblade.com>:
> >
> > I was writing a test case to get the $metadata and found that a
> toString() method never returns. The Java thread stays active and never
> exits.
> > Does anyone know why the last four tines of this test case do not work.
> What have I done wrong?
> > Hank
> >
> >  @Test
> >     public void getMetaData()
> >             throws Exception
> >     {
> >         ODataClient client = ODataClientFactory.getClient();
> >         String url = "http://localhost:8080/anyValidURL/$metadata";
> >         ODataServiceDocumentRequest req =
>  client.getRetrieveRequestFactory().getServiceDocumentRequest(url);
> >
> >         req.setFormat(ContentType.APPLICATION_XML);
> >
> >         ODataRetrieveResponse<ClientServiceDocument> res = req.execute();
> >
> >         if (res.getStatusCode() == 200)
> >         {
> >
> >             System.out.println("Success getting response.");
> >             // Error below: This never prints.
> >             System.out.println("response: toString()=" +
> res.getBody().toString());
> >             // You can comment out the line above and uncomment this and
> it never prints.
> >             //  System.out.println("response: getClass()=" +
> res.getBody().getClass());
> >         }
> >     }
>
>

Re: toString() hangs

Posted by mibo <mi...@apache.org>.
Hello Hank,

At first glance I do not see anything you have done wrong.
However I was not able to reproduce your mentioned behavior.
I executed the „retrieveServiceDocument“ test method in the
„org.apache.olingo.fit.base.ServiceDocumentTestITCase“ test class.
And when I insert an "system out" line:
41: final ClientServiceDocument serviceDocument = res.getBody();
42: System.out.println(serviceDocument.toString());
I get the expected output: org.apache.olingo.client.api.domain.ClientServiceDocument@45ae9c3f

In what environment (e.g. Tomcat) do you run what type of service (e.g. Olingo Test Server „tecsvc“)?

Best Regards,
Michael

> Am 19.09.2015 um 14:37 schrieb Hank Bruning <ha...@jblade.com>:
> 
> I was writing a test case to get the $metadata and found that a toString() method never returns. The Java thread stays active and never exits.
> Does anyone know why the last four tines of this test case do not work. What have I done wrong?
> Hank
> 
>  @Test
>     public void getMetaData()
>             throws Exception
>     {
>         ODataClient client = ODataClientFactory.getClient();
>         String url = "http://localhost:8080/anyValidURL/$metadata";
>         ODataServiceDocumentRequest req =         client.getRetrieveRequestFactory().getServiceDocumentRequest(url);
> 
>         req.setFormat(ContentType.APPLICATION_XML);
> 
>         ODataRetrieveResponse<ClientServiceDocument> res = req.execute();
> 
>         if (res.getStatusCode() == 200)
>         {
>            
>             System.out.println("Success getting response.");
>             // Error below: This never prints. 
>             System.out.println("response: toString()=" + res.getBody().toString());
>             // You can comment out the line above and uncomment this and it never prints.
>             //  System.out.println("response: getClass()=" + res.getBody().getClass());
>         }
>     }