Changeset 5561 for ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/SanboxTest.java
- Timestamp:
- 08/18/14 14:48:56 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/SanboxTest.java
r5560 r5561 17 17 import clarin.cmdi.componentregistry.persistence.jpa.CommentsDao; 18 18 import clarin.cmdi.componentregistry.persistence.jpa.UserDao; 19 import clarin.cmdi.componentregistry.rss.Rss; 19 20 import com.sun.jersey.api.client.ClientResponse; 20 21 import java.text.ParseException; … … 207 208 208 209 @Test 209 public void testGetGroup Comments() throws Exception {210 211 System.out.println("test getGroup Comments");210 public void testGetGroupRss() throws Exception { 211 212 System.out.println("test getGroupRss"); 212 213 213 214 fillUpGroupA(); … … 215 216 fillUpGroupC(); 216 217 218 219 // lists of profiles and components 220 221 Rss response = this.getAuthenticatedResource(getResource() 222 .path("/registry/profiles/rss").queryParam("registrySpace", "group").queryParam("groupid", "1")).accept(MediaType.APPLICATION_XML) 223 .get(Rss.class); 224 assertEquals(1, response.getChannel().getItem().size()); 225 226 response = this.getAuthenticatedResource(getResource() 227 .path("/registry/components/rss").queryParam("registrySpace", "group").queryParam("groupid", "1")).accept(MediaType.APPLICATION_XML) 228 .get(Rss.class); 229 assertEquals(2, response.getChannel().getItem().size()); 230 231 response = this.getAuthenticatedResource(getResource() 232 .path("/registry/profiles/rss").queryParam("registrySpace", "group").queryParam("groupid", "2")).accept(MediaType.APPLICATION_XML) 233 .get(Rss.class); 234 assertEquals(1, response.getChannel().getItem().size()); 235 236 response = this.getAuthenticatedResource(getResource() 237 .path("/registry/components/rss").queryParam("registrySpace", "group").queryParam("groupid", "2")).accept(MediaType.APPLICATION_XML) 238 .get(Rss.class); 239 assertEquals(2, response.getChannel().getItem().size()); 240 241 ClientResponse clientResponse = this.getAuthenticatedResource(getResource() 242 .path("/registry/components").queryParam("registrySpace", "group").queryParam("groupid", "3")).accept(MediaType.APPLICATION_XML) 243 .get(ClientResponse.class); 244 245 assertEquals(403, clientResponse.getStatus()); 217 246 218 247 RegistryTestHelper.addComment(baseRegistry, "COMMENTc1", ComponentDescription.COMPONENT_PREFIX + "component-1", … … 231 260 // lists 232 261 233 List<Comment>response = this.getAuthenticatedResource(getResource()234 .path("/registry/components/" + ComponentDescription.COMPONENT_PREFIX + "component-1" + "/comments/ "))235 .accept(MediaType.APPLICATION_XML) 236 .get( COMMENT_LIST_GENERICTYPE);237 assertEquals(1, response. size());238 239 response = this.getAuthenticatedResource(getResource() 240 .path("/registry/ components/" + ProfileDescription.PROFILE_PREFIX + "profile-1" + "/comments/"))241 .accept(MediaType.APPLICATION_XML) 242 .get( COMMENT_LIST_GENERICTYPE);243 assertEquals(1, response. size());244 245 response = this.getAuthenticatedResource(getResource() 246 .path("/registry/components/" + ComponentDescription.COMPONENT_PREFIX + "Bcomponent-1" + "/comments/ "))247 .accept(MediaType.APPLICATION_XML) 248 .get( COMMENT_LIST_GENERICTYPE);249 assertEquals(1, response. size());250 251 response = this.getAuthenticatedResource(getResource() 252 .path("/registry/ components/" + ProfileDescription.PROFILE_PREFIX + "Bprofile-1" + "/comments/"))253 .accept(MediaType.APPLICATION_XML) 254 .get( COMMENT_LIST_GENERICTYPE);255 assertEquals(1, response. size());256 257 258 259 ClientResponseclientResponse = this.getAuthenticatedResource(getResource()260 .path("/registry/profiles/" + ProfileDescription.PROFILE_PREFIX+"Cprofile-1 "))262 response = this.getAuthenticatedResource(getResource() 263 .path("/registry/components/" + ComponentDescription.COMPONENT_PREFIX + "component-1" + "/comments/rss")) 264 .accept(MediaType.APPLICATION_XML) 265 .get(Rss.class); 266 assertEquals(1, response.getChannel().getItem().size()); 267 268 response = this.getAuthenticatedResource(getResource() 269 .path("/registry/profiles/" + ProfileDescription.PROFILE_PREFIX + "profile-1" + "/comments/rss")) 270 .accept(MediaType.APPLICATION_XML) 271 .get(Rss.class); 272 assertEquals(1, response.getChannel().getItem().size()); 273 274 response = this.getAuthenticatedResource(getResource() 275 .path("/registry/components/" + ComponentDescription.COMPONENT_PREFIX + "Bcomponent-1" + "/comments/rss")) 276 .accept(MediaType.APPLICATION_XML) 277 .get(Rss.class); 278 assertEquals(1, response.getChannel().getItem().size()); 279 280 response = this.getAuthenticatedResource(getResource() 281 .path("/registry/profiles/" + ProfileDescription.PROFILE_PREFIX + "Bprofile-1" + "/comments/rss")) 282 .accept(MediaType.APPLICATION_XML) 283 .get(Rss.class); 284 assertEquals(1, response.getChannel().getItem().size()); 285 286 287 288 clientResponse = this.getAuthenticatedResource(getResource() 289 .path("/registry/profiles/" + ProfileDescription.PROFILE_PREFIX+"Cprofile-1/comments/rss")) 261 290 .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); 262 291 assertEquals(403, clientResponse.getStatus()); 263 292 264 293 clientResponse = this.getAuthenticatedResource(getResource() 265 .path("/registry/components/" + ComponentDescription.COMPONENT_PREFIX+"Ccomponent-1 "))294 .path("/registry/components/" + ComponentDescription.COMPONENT_PREFIX+"Ccomponent-1/comments/rss")) 266 295 .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); 267 296 assertEquals(403, clientResponse.getStatus());
Note: See TracChangeset
for help on using the changeset viewer.