Ignore:
Timestamp:
08/18/14 19:28:05 (10 years ago)
Author:
olhsha@mpi.nl
Message:

Unit test for getting xml, xsd for descriptions in groups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RestGroupServiceTest.java

    r5567 r5568  
    12941294        assertEquals(403, cresponse.getStatus());
    12951295    }
     1296       
     1297        @Test
     1298    public void testGetRegisteredGroupProfilecomponentRawData() throws Exception {
     1299
     1300        System.out.println("test getRegisteredComponentAndProfileRawData");
     1301
     1302        fillUpGroupB();       
     1303        fillUpGroupC();
     1304
     1305        String id = ComponentDescription.COMPONENT_PREFIX + "Bcomponent-1";
     1306        String component = this.getAuthenticatedResource(getResource()
     1307                .path("/registry/components/" + id + "/xsd"))
     1308                .accept(MediaType.TEXT_XML).get(String.class).trim();
     1309        assertTrue(component
     1310                .startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?><xs:schema"));
     1311        assertTrue(component.endsWith("</xs:schema>"));
     1312
     1313        component = this.getAuthenticatedResource(getResource().path("/registry/components/" + id + "/xml"))
     1314                .accept(MediaType.TEXT_XML).get(String.class).trim();
     1315        assertTrue(component
     1316                .startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<CMD_ComponentSpec"));
     1317        assertTrue(component.endsWith("</CMD_ComponentSpec>"));
     1318        assertTrue(component.contains("xsi:schemaLocation"));
     1319       
     1320        id = ProfileDescription.PROFILE_PREFIX + "Bprofile-1";
     1321        String profile = this.getAuthenticatedResource(getResource()
     1322                .path("/registry/profiles/" + id + "/xsd"))
     1323                .accept(MediaType.TEXT_XML).get(String.class).trim();
     1324        assertTrue(profile
     1325                .startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?><xs:schema"));
     1326        assertTrue(profile.endsWith("</xs:schema>"));
     1327
     1328        profile = this.getAuthenticatedResource(getResource().path("/registry/profiles/" + id + "/xml"))
     1329                .accept(MediaType.TEXT_XML).get(String.class).trim();
     1330        assertTrue(profile
     1331                .startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<CMD_ComponentSpec"));
     1332        assertTrue(profile.endsWith("</CMD_ComponentSpec>"));
     1333        assertTrue(profile.contains("xsi:schemaLocation"));
     1334
     1335        id = ComponentDescription.COMPONENT_PREFIX + "Ccomponent-1";
     1336        ClientResponse resp = this.getAuthenticatedResource(getResource()
     1337                .path("/registry/components/" + id + "/xsd"))
     1338                .accept(MediaType.TEXT_XML).get( ClientResponse.class);
     1339        assertEquals(403, resp.getStatus());
     1340       
     1341        id = ProfileDescription.PROFILE_PREFIX + "Cprofile-1";
     1342       resp = this.getAuthenticatedResource(getResource()
     1343                .path("/registry/profiles/" + id + "/xsd"))
     1344                .accept(MediaType.TEXT_XML).get( ClientResponse.class);
     1345        assertEquals(403, resp.getStatus());
     1346       
     1347       
     1348    }
    12961349
    12971350}
Note: See TracChangeset for help on using the changeset viewer.