Changeset 1892
- Timestamp:
- 04/19/12 14:44:19 (12 years ago)
- Location:
- ComponentRegistry/trunk/ComponentRegistry/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/ComponentRegistry.java
r1753 r1892 151 151 * @throws ComponentRegistryException 152 152 */ 153 List<Comment> getCommentsInProfile(String profileId ) throws ComponentRegistryException;153 List<Comment> getCommentsInProfile(String profileId, Principal principal) throws ComponentRegistryException; 154 154 155 155 /** … … 160 160 * @throws ComponentRegistryException 161 161 */ 162 Comment getSpecifiedCommentInProfile(String profileId, String commentId ) throws ComponentRegistryException;162 Comment getSpecifiedCommentInProfile(String profileId, String commentId, Principal principal) throws ComponentRegistryException; 163 163 164 164 /** … … 168 168 * @throws ComponentRegistryException 169 169 */ 170 List<Comment> getCommentsInComponent(String componentId ) throws ComponentRegistryException;170 List<Comment> getCommentsInComponent(String componentId, Principal principal) throws ComponentRegistryException; 171 171 172 172 /** … … 177 177 * @throws ComponentRegistryException 178 178 */ 179 Comment getSpecifiedCommentInComponent(String componentId, String commentId ) throws ComponentRegistryException;179 Comment getSpecifiedCommentInComponent(String componentId, String commentId, Principal principal) throws ComponentRegistryException; 180 180 181 181 /** -
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java
r1870 r1892 35 35 import clarin.cmdi.componentregistry.model.ProfileDescription; 36 36 import clarin.cmdi.componentregistry.model.RegistryUser; 37 import java.util.Collection; 38 import java.util.Collections; 37 39 38 40 /** … … 129 131 130 132 @Override 131 public List<Comment> getCommentsInProfile(String profileId ) throws ComponentRegistryException {133 public List<Comment> getCommentsInProfile(String profileId, Principal principal) throws ComponentRegistryException { 132 134 try { 133 135 if (profileDescriptionDao.isInRegistry(profileId, getUserId())) { 134 return commentsDao.getCommentsFromProfile(profileId); 136 final List<Comment> commentsFromProfile = commentsDao.getCommentsFromProfile(profileId); 137 setCanDeleteInComments(commentsFromProfile, principal); 138 return commentsFromProfile; 135 139 } else { 136 140 // Profile does not exist (at least not in this registry) … … 143 147 144 148 @Override 145 public Comment getSpecifiedCommentInProfile(String profileId, String commentId ) throws ComponentRegistryException {149 public Comment getSpecifiedCommentInProfile(String profileId, String commentId, Principal principal) throws ComponentRegistryException { 146 150 try { 147 151 Comment comment = commentsDao.getSpecifiedCommentFromProfile(commentId); … … 149 153 && profileId.equals(comment.getProfileDescriptionId()) 150 154 && profileDescriptionDao.isInRegistry(comment.getProfileDescriptionId(), getUserId())) { 155 setCanDeleteInComments(Collections.singleton(comment), principal); 151 156 return comment; 152 157 } else { … … 160 165 161 166 @Override 162 public List<Comment> getCommentsInComponent(String componentId ) throws ComponentRegistryException {167 public List<Comment> getCommentsInComponent(String componentId, Principal principal) throws ComponentRegistryException { 163 168 try { 164 169 if (componentDescriptionDao.isInRegistry(componentId, getUserId())) { 165 return commentsDao.getCommentsFromComponent(componentId); 170 final List<Comment> commentsFromComponent = commentsDao.getCommentsFromComponent(componentId); 171 setCanDeleteInComments(commentsFromComponent, principal); 172 return commentsFromComponent; 166 173 } else { 167 174 // Component does not exist (at least not in this registry) … … 174 181 175 182 @Override 176 public Comment getSpecifiedCommentInComponent(String componentId, String commentId ) throws ComponentRegistryException {183 public Comment getSpecifiedCommentInComponent(String componentId, String commentId, Principal principal) throws ComponentRegistryException { 177 184 try { 178 185 Comment comment = commentsDao.getSpecifiedCommentFromComponent(commentId); … … 180 187 && componentId.equals(comment.getComponentDescriptionId()) 181 188 && componentDescriptionDao.isInRegistry(comment.getComponentDescriptionId(), getUserId())) { 189 setCanDeleteInComments(Collections.singleton(comment), principal); 182 190 return comment; 183 191 } else { … … 187 195 } catch (DataAccessException ex) { 188 196 throw new ComponentRegistryException("Database access error while trying to get comment from component", ex); 197 } 198 } 199 200 /** 201 * Sets the {@link Comment#setCanDelete(boolean) canDelete} property on all comments in the provided collection for the perspective of 202 * the specified principal. 203 * Comment owners (determined by {@link Comment#getUserId() }) and admins can delete, others cannot. 204 * 205 * @param comments comments to configure 206 * @param principal user to configure for 207 * @see Comment#isCanDelete() 208 */ 209 private void setCanDeleteInComments(Collection<Comment> comments, Principal principal) { 210 if (principal != null && principal.getName() != null) { 211 final RegistryUser registryUser = userDao.getByPrincipalName(principal.getName()); 212 final String registryUserId = registryUser.getId().toString(); 213 final boolean isAdmin = configuration.isAdminUser(principal); 214 for (Comment comment : comments) { 215 comment.setCanDelete(isAdmin || comment.getUserId().equals(registryUserId)); 216 } 189 217 } 190 218 } -
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/Comment.java
r1697 r1892 12 12 /** 13 13 * 14 * @author jean-charles FerriÚres <jean-charles.ferrieres@mpi.nl> 14 * @author Jean-Charles FerriÚres <jean-charles.ferrieres@mpi.nl> 15 * @author Twan Goosen <twan.goosen@mpi.nl> 15 16 */ 16 17 @XmlRootElement(name = "comment") … … 24 25 private String id; 25 26 private String userName; 27 private boolean canDelete; 26 28 @XmlTransient // this prevents userId from being serialized to XML and thus exposed (which is useless and undesirable) 27 29 private String userId; … … 76 78 77 79 /** 78 * 80 * 79 81 * @return userName, that is the user's 'real' name, not login name 80 82 */ … … 88 90 public void setUserName(String userName) { 89 91 this.userName = userName; 92 } 93 94 /** 95 * @return whether comment can be deleted 96 */ 97 public boolean isCanDelete() { 98 return canDelete; 99 } 100 101 /** 102 * @param canDelete whether comment can be deleted 103 */ 104 public void setCanDelete(boolean canDelete) { 105 this.canDelete = canDelete; 90 106 } 91 107 … … 103 119 /* 104 120 * Helper method to set the Date in the same format 105 * @param time, long that contains the time to be set 121 * @param time, long that contains the time to be set 106 122 */ 107 123 public static String createNewDate(long time) { -
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r1870 r1892 48 48 @Path("/registry") 49 49 public class ComponentRegistryRestService { 50 50 51 51 @Context 52 52 private UriInfo uriInfo; … … 65 65 @Inject(value = "componentRegistryFactory") 66 66 private ComponentRegistryFactory componentRegistryFactory; 67 67 68 68 private ComponentRegistry getRegistry(boolean userspace) { 69 69 Principal userPrincipal = security.getUserPrincipal(); … … 71 71 return getRegistry(userspace, userCredentials); 72 72 } 73 73 74 74 private ComponentRegistry getRegistry(boolean userspace, UserCredentials userCredentials) { 75 75 return componentRegistryFactory.getComponentRegistry(userspace, userCredentials); … … 88 88 return principal; 89 89 } 90 90 91 91 private UserCredentials getUserCredentials(Principal userPrincipal) { 92 92 UserCredentials userCredentials = null; … … 96 96 return userCredentials; 97 97 } 98 98 99 99 @GET 100 100 @Path("/components") … … 107 107 return components; 108 108 } 109 109 110 110 @GET 111 111 @Path("/profiles") … … 114 114 @QueryParam(METADATA_EDITOR_PARAM) @DefaultValue("false") boolean metadataEditor) throws ComponentRegistryException { 115 115 long start = System.currentTimeMillis(); 116 116 117 117 List<ProfileDescription> profiles; 118 118 if (metadataEditor) { … … 121 121 profiles = getRegistry(userspace).getProfileDescriptions(); 122 122 } 123 123 124 124 LOG.info("Releasing " + profiles.size() + " registered profiles into the world (" + (System.currentTimeMillis() - start) 125 125 + " millisecs)"); 126 126 return profiles; 127 127 } 128 128 129 129 @GET 130 130 @Path("/components/{componentId}") … … 140 140 } 141 141 } 142 142 143 143 @GET 144 144 @Path("/components/{componentId}/{rawType}") … … 157 157 if ("xml".equalsIgnoreCase(rawType)) { 158 158 result = new StreamingOutput() { 159 159 160 160 @Override 161 161 public void write(OutputStream output) throws IOException, WebApplicationException { … … 170 170 } else if ("xsd".equalsIgnoreCase(rawType)) { 171 171 result = new StreamingOutput() { 172 172 173 173 @Override 174 174 public void write(OutputStream output) throws IOException, WebApplicationException { … … 179 179 throw new WebApplicationException(e, Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build()); 180 180 } 181 181 182 182 } 183 183 }; … … 192 192 } 193 193 } 194 194 195 195 public ComponentRegistry findRegistry(String id, RegistryClosure<? extends AbstractDescription> clos) throws ComponentRegistryException { 196 196 AbstractDescription desc = null; … … 209 209 return result; 210 210 } 211 211 212 212 @GET 213 213 @Path("/profiles/{profileId}") … … 223 223 } 224 224 } 225 225 226 226 @GET 227 227 @Path("/components/usage/{componentId}") … … 233 233 List<ComponentDescription> components = registry.getUsageInComponents(componentId); 234 234 List<ProfileDescription> profiles = registry.getUsageInProfiles(componentId); 235 235 236 236 LOG.info("Found " + components.size() + " components and " + profiles.size() + " profiles that use component " + componentId 237 237 + " (" + (System.currentTimeMillis() - start) + " millisecs)"); 238 238 239 239 List<AbstractDescription> usages = new ArrayList<AbstractDescription>(components.size() + profiles.size()); 240 240 usages.addAll(components); 241 241 usages.addAll(profiles); 242 242 243 243 return usages; 244 244 } catch (ComponentRegistryException e) { … … 247 247 } 248 248 } 249 249 250 250 @GET 251 251 @Path("/profiles/{profileId}/comments") … … 253 253 public List<Comment> getCommentsFromProfile(@PathParam("profileId") String profileId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 254 254 long start = System.currentTimeMillis(); 255 List<Comment> comments = getRegistry(userspace).getCommentsInProfile(profileId); 255 final Principal principal = security.getUserPrincipal(); 256 List<Comment> comments = getRegistry(userspace).getCommentsInProfile(profileId, principal); 256 257 LOG.info("Releasing " + comments.size() + " registered comments in Profile into the world (" + (System.currentTimeMillis() - start) 257 258 + " millisecs)"); 258 259 return comments; 259 260 } 260 261 261 262 @GET 262 263 @Path("/components/{componentId}/comments") … … 264 265 public List<Comment> getCommentsFromComponent(@PathParam("componentId") String componentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 265 266 long start = System.currentTimeMillis(); 266 List<Comment> comments = getRegistry(userspace).getCommentsInComponent(componentId); 267 final Principal principal = security.getUserPrincipal(); 268 List<Comment> comments = getRegistry(userspace).getCommentsInComponent(componentId, principal); 267 269 LOG.info("Releasing " + comments.size() + " registered comments in Component into the world (" + (System.currentTimeMillis() - start) 268 270 + " millisecs)"); 269 271 return comments; 270 272 } 271 273 272 274 @GET 273 275 @Path("/profiles/{profileId}/comments/{commentId}") … … 275 277 public Comment getSpecifiedCommentFromProfile(@PathParam("profileId") String profileId, @PathParam("commentId") String commentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 276 278 LOG.info(" Comments of component with id" + commentId + " are requested."); 277 return getRegistry(userspace).getSpecifiedCommentInProfile(profileId, commentId); 278 } 279 279 final Principal principal = security.getUserPrincipal(); 280 return getRegistry(userspace).getSpecifiedCommentInProfile(profileId, commentId, principal); 281 } 282 280 283 @GET 281 284 @Path("/components/{componentId}/comments/{commentId}") … … 283 286 public Comment getSpecifiedCommentFromComponent(@PathParam("componentId") String componentId, @PathParam("commentId") String commentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 284 287 LOG.info(" Comments of component with id" + commentId + " are requested."); 285 return getRegistry(userspace).getSpecifiedCommentInComponent(componentId, commentId); 288 final Principal principal = security.getUserPrincipal(); 289 return getRegistry(userspace).getSpecifiedCommentInComponent(componentId, commentId, principal); 286 290 } 287 291 … … 305 309 } 306 310 } 307 311 308 312 @POST 309 313 @Path("/profiles/{profileId}/comments/{commentId}") … … 316 320 } 317 321 } 318 322 319 323 @POST 320 324 @Path("/components/{componentId}/comments/{commentId}") … … 327 331 } 328 332 } 329 333 330 334 @POST 331 335 @Path("/profiles/{profileId}/publish") … … 351 355 } 352 356 } 353 357 354 358 @POST 355 359 @Path("/profiles/{profileId}/update") … … 376 380 return Response.status(Status.UNAUTHORIZED).entity(ex.getMessage()).build(); 377 381 } 378 382 379 383 } 380 384 … … 398 402 } 399 403 } 400 404 401 405 @POST 402 406 @Path("/components/{componentId}/publish") … … 423 427 } 424 428 } 425 429 426 430 @POST 427 431 @Path("/components/{componentId}/update") … … 448 452 } 449 453 } 450 454 451 455 private void updateDescription(AbstractDescription desc, String name, String description, String domainName, String group) { 452 456 desc.setName(name); … … 456 460 desc.setRegistrationDate(AbstractDescription.createNewDate()); 457 461 } 458 462 459 463 @DELETE 460 464 @Path("/components/{componentId}") … … 482 486 return Response.ok().build(); 483 487 } 484 488 485 489 @DELETE 486 490 @Path("/profiles/{profileId}") … … 507 511 return Response.ok().build(); 508 512 } 509 513 510 514 @DELETE 511 515 @Path("/profiles/{profileId}/comments/{commentId}") … … 515 519 final Principal principal = checkAndGetUserPrincipal(); 516 520 final ComponentRegistry registry = getRegistry(userspace); 517 final Comment comment = registry.getSpecifiedCommentInProfile(profileId, commentId );521 final Comment comment = registry.getSpecifiedCommentInProfile(profileId, commentId, principal); 518 522 if (comment != null && profileId.equals(comment.getProfileDescriptionId())) { 519 523 LOG.info("Comment with id: " + commentId + " set for deletion."); … … 538 542 return Response.ok().build(); 539 543 } 540 544 541 545 @DELETE 542 546 @Path("/components/{componentId}/comments/{commentId}") … … 546 550 final Principal principal = checkAndGetUserPrincipal(); 547 551 final ComponentRegistry registry = getRegistry(userspace); 548 final Comment comment = registry.getSpecifiedCommentInComponent(componentId, commentId );552 final Comment comment = registry.getSpecifiedCommentInComponent(componentId, commentId, principal); 549 553 if (comment != null && componentId.equals(comment.getComponentDescriptionId())) { 550 554 LOG.info("Comment with id: " + commentId + " set for deletion."); … … 569 573 return Response.ok().build(); 570 574 } 571 575 572 576 @GET 573 577 @Path("/profiles/{profileId}/{rawType}") … … 584 588 checkAndThrowDescription(desc, profileId); 585 589 String fileName = desc.getName() + "." + rawType; 586 590 587 591 if ("xml".equalsIgnoreCase(rawType)) { 588 592 result = new StreamingOutput() { 589 593 590 594 @Override 591 595 public void write(OutputStream output) throws IOException, WebApplicationException { … … 600 604 } else if ("xsd".equalsIgnoreCase(rawType)) { 601 605 result = new StreamingOutput() { 602 606 603 607 @Override 604 608 public void write(OutputStream output) throws IOException, WebApplicationException { … … 621 625 } 622 626 } 623 627 624 628 private void checkAndThrowDescription(AbstractDescription desc, String id) { 625 629 if (desc == null) { … … 627 631 } 628 632 } 629 633 630 634 private Response createDownloadResponse(StreamingOutput result, String fileName) { 631 635 //Making response so it triggers browsers native save as dialog. … … 633 637 "attachment; filename=\"" + fileName + "\"").entity(result).build(); 634 638 return response; 635 636 } 637 639 640 } 641 638 642 @POST 639 643 @Path("/profiles") … … 659 663 } 660 664 } 661 665 662 666 @POST 663 667 @Path("/components") … … 683 687 } 684 688 } 685 689 686 690 @POST 687 691 @Path("/components/{componentId}/comments") … … 709 713 } 710 714 } 711 715 712 716 @POST 713 717 @Path("/profiles/{profileId}/comments") … … 735 739 } 736 740 } 737 741 738 742 @GET 739 743 @Path("/pingSession") … … 750 754 return Response.ok().entity("<session stillActive=\"" + stillActive + "\"/>").build(); 751 755 } 752 756 753 757 private Response register(InputStream input, AbstractDescription desc, UserCredentials userCredentials, boolean userspace, 754 758 RegisterAction action) { … … 794 798 } 795 799 } 796 800 797 801 private Response registerComment(InputStream input, ComponentRegistry registry, boolean userspace, 798 802 AbstractDescription description, Principal principal, UserCredentials userCredentials) { … … 814 818 } 815 819 } 816 820 817 821 int returnCode = registry.registerComment(com, principal.getName()); 818 822 if (returnCode == 0) { … … 840 844 } 841 845 } 842 846 843 847 private ComponentDescription createNewComponentDescription() { 844 848 ComponentDescription desc = ComponentDescription.createNewDescription(); … … 846 850 return desc; 847 851 } 848 852 849 853 private ProfileDescription createNewProfileDescription() { 850 854 ProfileDescription desc = ProfileDescription.createNewDescription(); … … 852 856 return desc; 853 857 } 854 858 855 859 private Comment createNewComment() { 856 860 Comment com = Comment.createANewComment(); 857 861 return com; 858 862 } 859 863 860 864 private String createXlink(String id) { 861 865 URI uri = uriInfo.getRequestUriBuilder().path(id).build(); 862 866 return uri.toString(); 863 867 } 864 868 865 869 private void validate(RegisterResponse response, Validator... validators) { 866 870 for (Validator validator : validators) { … … 872 876 } 873 877 } 874 878 875 879 private void validateComment(CommentResponse response, Validator... validators) { 876 880 for (Validator validator : validators) { -
ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImplTest.java
r1816 r1892 1 1 package clarin.cmdi.componentregistry.impl.database; 2 3 import static org.junit.Assert.assertEquals;4 import static org.junit.Assert.assertNotNull;5 import static org.junit.Assert.assertNull;6 import static org.junit.Assert.assertTrue;7 import static org.junit.Assert.fail;8 9 import java.io.ByteArrayOutputStream;10 import java.io.OutputStream;11 import java.util.Calendar;12 13 import org.apache.commons.lang.time.DateFormatUtils;14 import org.junit.Before;15 import org.junit.Test;16 import org.junit.runner.RunWith;17 import org.springframework.beans.factory.annotation.Autowired;18 import org.springframework.jdbc.core.JdbcTemplate;19 import org.springframework.test.context.ContextConfiguration;20 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;21 2 22 3 import clarin.cmdi.componentregistry.ComponentRegistry; … … 33 14 import clarin.cmdi.componentregistry.rest.DummyPrincipal; 34 15 import clarin.cmdi.componentregistry.rest.RegistryTestHelper; 16 import java.io.ByteArrayOutputStream; 17 import java.io.OutputStream; 18 import java.util.Calendar; 35 19 import java.util.Date; 36 20 import java.util.List; 21 import org.apache.commons.lang.time.DateFormatUtils; 22 import org.junit.Before; 23 import org.junit.Test; 24 import org.junit.runner.RunWith; 25 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.jdbc.core.JdbcTemplate; 27 import org.springframework.test.context.ContextConfiguration; 28 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 29 30 import static org.junit.Assert.*; 37 31 38 32 @RunWith(SpringJUnit4ClassRunner.class) … … 204 198 Comment comment = createComment(description); 205 199 register.registerComment(comment, USER_CREDS.getPrincipalName()); 206 assertEquals(1, register.getCommentsInProfile(description.getId() ).size());200 assertEquals(1, register.getCommentsInProfile(description.getId(), null).size()); 207 201 return comment; 208 202 } … … 669 663 assertEquals(0, description.getCommentsCount()); 670 664 671 List<Comment> comments = register.getCommentsInProfile(description.getId() );665 List<Comment> comments = register.getCommentsInProfile(description.getId(), null); 672 666 assertEquals(1, comments.size()); 673 667 … … 675 669 assertEquals("0", comment.getUserId()); 676 670 assertEquals(USER_CREDS.getDisplayName(), comment.getUserName()); 671 672 // Should not be allowed to delete, not authenticated 673 assertFalse(comment.isCanDelete()); 677 674 678 675 description = register.getProfileDescription(description.getId()); 679 676 assertEquals(1, description.getCommentsCount()); 677 678 // Test if owner can delete 679 comments = register.getCommentsInProfile(description.getId(), DummyPrincipal.DUMMY_PRINCIPAL); 680 assertTrue(comments.get(0).isCanDelete()); 681 682 // Test if admin can delete 683 userDao.insertUser(createUser(DummyPrincipal.DUMMY_ADMIN_CREDENTIALS)); 684 comments = register.getCommentsInProfile(description.getId(), PRINCIPAL_ADMIN); 685 assertTrue(comments.get(0).isCanDelete()); 680 686 } 681 687 … … 692 698 assertEquals(0, description.getCommentsCount()); 693 699 694 List<Comment> comments = register.getCommentsInProfile(description.getId() );700 List<Comment> comments = register.getCommentsInProfile(description.getId(), null); 695 701 assertEquals(1, comments.size()); 696 702 … … 714 720 assertNotNull(comment); 715 721 716 List<Comment> comments = register.getCommentsInProfile(description.getId() );722 List<Comment> comments = register.getCommentsInProfile(description.getId(), null); 717 723 assertEquals(1, comments.size()); 718 724 description = register.getProfileDescription(description.getId()); … … 721 727 comment = comments.get(0); 722 728 register.deleteComment(comment.getId(), USER_CREDS.getPrincipal()); 723 comments = register.getCommentsInProfile(description.getId() );729 comments = register.getCommentsInProfile(description.getId(), null); 724 730 assertEquals(0, comments.size()); 725 731 description = register.getProfileDescription(description.getId()); … … 739 745 assertNotNull(comment); 740 746 741 List<Comment> comments = register.getCommentsInProfile(description.getId() );747 List<Comment> comments = register.getCommentsInProfile(description.getId(), null); 742 748 assertEquals(1, comments.size()); 743 749 comment = comments.get(0); -
ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/model/CommentResponseTest.java
r1699 r1892 17 17 18 18 /** 19 * Test with no validate attribute should return errors 20 * @throws Exception 19 * Test with no validate attribute should return errors 20 * 21 * @throws Exception 21 22 */ 22 23 @Test … … 46 47 /** 47 48 * Test successfully processed 48 * @throws Exception 49 * 50 * @throws Exception 49 51 */ 50 52 @Test … … 66 68 expected += " <id>myId</id>\n"; 67 69 expected += " <userName>J. Unit</userName>\n"; 70 expected += " <canDelete>false</canDelete>\n"; 68 71 expected += " </comment>\n"; 69 72 expected += "</commentResponse>\n"; -
ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/model/CommentTest.java
r1699 r1892 1 1 package clarin.cmdi.componentregistry.model; 2 3 import static org.junit.Assert.assertEquals;4 2 5 3 import clarin.cmdi.componentregistry.MDMarshaller; … … 7 5 import java.io.ByteArrayOutputStream; 8 6 import org.junit.Test; 7 8 import static org.junit.Assert.assertEquals; 9 9 10 10 /** … … 34 34 expected += " <id>1</id>\n"; 35 35 expected += " <userName>J. Unit</userName>\n"; 36 expected += " <canDelete>false</canDelete>\n"; 36 37 expected += "</comment>\n"; 37 38 assertEquals(expected, out.toString()); … … 62 63 expected += " <id>1</id>\n"; 63 64 expected += " <userName>J. Unit</userName>\n"; 65 expected += " <canDelete>false</canDelete>\n"; 64 66 expected += "</comment>\n"; 65 67 assertEquals(expected, out.toString()); -
ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/DummyPrincipal.java
r1329 r1892 16 16 } 17 17 }; 18 public static final UserCredentials DUMMY_ADMIN_CREDENTIALS = new UserCredentials(DUMMY_ADMIN_PRINCIPAL); 18 19 private final String username; 19 20
Note: See TracChangeset
for help on using the changeset viewer.