An issue of starting with the CDMI RI code

37 views
Skip to first unread message

FubiaoXia

unread,
Apr 19, 2016, 11:30:54 PM4/19/16
to SNIA Cloud
Hello guys,

I'm studying CDMI spec and try to explore more based on the CDMI RI code from the latest version in github (https://github.com/SNIA/CDMI)

I use the Netbeans 8.1 with Java v7 (which I indicate the complier version in the pom.xml).   When I try to do the unit test/integration tests, it seems some issues happen in my configuration. The results show that the CDMI client didn't find the correct ROOT container, or the system even did not start the CDMI server. But I found there is a ServerContext.java class which should prepare the environment for such tests, is my understanding right?

The procedure I did as follows:
1. I compile the project with indicated Java v7 compiler without maven tests.
2. I "run" the project in netbeans IDE with glassfish 4.1.1, and I found it deployed via the server console. Though there is no "welcome" page like index.html presented.
3. I right-click the files in the "test package".

 For example, I did the "Test File" with "CapabilityTest.java", and the following log occurs:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.snia.cdmiserver.CapabilityTests
org.apache.http.message.BasicHttpResponse@3d2fdcd7
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.578 sec <<< FAILURE! - in org.snia.cdmiserver.CapabilityTests
shouldShowRootCapability(org.snia.cdmiserver.CapabilityTests)  Time elapsed: 0.561 sec  <<< FAILURE!
java.lang.AssertionError:
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>
 at org.junit.Assert.assertThat(Assert.java:778)
 at org.junit.Assert.assertThat(Assert.java:736)
 at org.snia.cdmiserver.CapabilityTests.shouldShowRootCapability(CapabilityTests.java:105)
shouldShowContainerCapability(org.snia.cdmiserver.CapabilityTests)  Time elapsed: 0.003 sec  <<< FAILURE!
java.lang.AssertionError:
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>
 at org.junit.Assert.assertThat(Assert.java:778)
 at org.junit.Assert.assertThat(Assert.java:736)
 at org.snia.cdmiserver.CapabilityTests.shouldShowContainerCapability(CapabilityTests.java:133)
shouldShowContainerDefaultCapability(org.snia.cdmiserver.CapabilityTests)  Time elapsed: 0.005 sec  <<< FAILURE!
java.lang.AssertionError:
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>
 at org.junit.Assert.assertThat(Assert.java:778)
 at org.junit.Assert.assertThat(Assert.java:736)
 at org.snia.cdmiserver.CapabilityTests.shouldShowContainerDefaultCapability(CapabilityTests.java:161)
shouldShowDataObjectCapability(org.snia.cdmiserver.CapabilityTests)  Time elapsed: 0.005 sec  <<< FAILURE!
java.lang.AssertionError:
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>
 at org.junit.Assert.assertThat(Assert.java:778)
 at org.junit.Assert.assertThat(Assert.java:736)
 at org.snia.cdmiserver.CapabilityTests.shouldShowDataObjectCapability(CapabilityTests.java:188)

Results :
Failed tests:
  CapabilityTests.shouldShowContainerCapability:133
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>
  CapabilityTests.shouldShowContainerDefaultCapability:161
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>
  CapabilityTests.shouldShowDataObjectCapability:188
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>
  CapabilityTests.shouldShowRootCapability:105
Expected: status code 200
     got: <HTTP/1.1 404 Not Found>

Tests run: 4, Failures: 4, Errors: 0, Skipped: 0



----------------------------------------------------end of my test log--

Thanks very much for any reply!!

Mark Carlson

unread,
Apr 19, 2016, 11:39:51 PM4/19/16
to snia-...@googlegroups.com
Works fine for me:

$ java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

-- mark
--
You received this message because you are subscribed to the Google Groups "SNIA Cloud" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snia-cloud+...@googlegroups.com.
To post to this group, send email to snia-...@googlegroups.com.
Visit this group at https://groups.google.com/group/snia-cloud.
For more options, visit https://groups.google.com/d/optout.

FubiaoXia

unread,
Apr 20, 2016, 6:58:57 AM4/20/16
to SNIA Cloud
Thanks Mark!  So happy to see people are still active in this group!

Probably I did not explain  clearly about my questions.
My story is: the code (SNIA CDMI RI from the ) built successfully with java version 7, but I Failed in testing, that is either:
1. I do the "maven verify" to run the "CapabilityTest.java", "ContainerTest.java","DataObjectTest.java" together, which I suppose is the integration test by the maven surefire plugin.
2. OR I do the single test ----  test file "CapabilityTest.java", it fails in all four sub-tests. And you might find the logs above.
And the failures show I cannot even GET /capabilities in ROOT "/". the related  code is(
HttpResponse response = client.request(GET, "/cdmi_capabilities")
                .withAccept("application/cdmi-capability")
                .send();)

Then I simply add one test method in CapalibilityTest.java. The code is:
...
@Test
    public void basicHttpTest() throws Exception
    {
       
        HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
        System.out.println(request.getRequestLine().getMethod());
        System.out.println(request.getRequestLine().getUri());
        System.out.println(request.getProtocolVersion());
        System.out.println(request.getRequestLine().toString());
   
       
         HttpResponse response1 = client.request(GET, "/")
                .send();
        assertThat(response1.getStatusLine(), hasStatusCode(200));
       System.out.println(response1.toString());
       
    }
...


The above simple code passes the test.
So I guess my  runtime environment is OK for normal http request. But it is not OK (maybe some configures need to be changed I guess?) for CDMI-like request. What's wrong with that? Sorry for my stupid question :S
Reply all
Reply to author
Forward
0 new messages