Skip to content

Commit 3f7a913

Browse files
author
eugenp
committed
integration tests fixed
1 parent f841006 commit 3f7a913

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎src/main/java/org/rest/sec/web/controller/RoleController.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public Role findOneByName( @RequestParam( "name" ) final String name ){
104104

105105
@RequestMapping( method = RequestMethod.POST )
106106
@ResponseStatus( HttpStatus.CREATED )
107-
// @Secured( SecurityConstants.CAN_ROLE_WRITE )
107+
@Secured( SecurityConstants.CAN_ROLE_WRITE )
108108
public void create( @RequestBody final Role resource, final UriComponentsBuilder uriBuilder, final HttpServletResponse response ){
109109
createInternal( resource, uriBuilder, response );
110110
}
@@ -113,7 +113,7 @@ public void create( @RequestBody final Role resource, final UriComponentsBuilder
113113

114114
@RequestMapping( method = RequestMethod.PUT )
115115
@ResponseStatus( HttpStatus.OK )
116-
// @Secured( SecurityConstants.CAN_ROLE_WRITE )
116+
@Secured( SecurityConstants.CAN_ROLE_WRITE )
117117
public void update( @RequestBody final Role resource ){
118118
updateInternal( resource );
119119
}

‎src/main/java/org/rest/sec/web/controller/UserController.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
import org.rest.common.web.RestPreconditions;
1111
import org.rest.sec.model.dto.User;
1212
import org.rest.sec.persistence.service.dto.IUserService;
13+
import org.rest.sec.util.SecurityConstants;
1314
import org.rest.util.SearchCommonUtil;
1415
import org.rest.web.common.AbstractController;
1516
import org.rest.web.common.ISortingController;
1617
import org.springframework.beans.factory.annotation.Autowired;
1718
import org.springframework.dao.InvalidDataAccessApiUsageException;
1819
import org.springframework.http.HttpStatus;
20+
import org.springframework.security.access.annotation.Secured;
1921
import org.springframework.stereotype.Controller;
2022
import org.springframework.web.bind.annotation.PathVariable;
2123
import org.springframework.web.bind.annotation.RequestBody;
@@ -102,7 +104,6 @@ public User findOneByName( @RequestParam( "name" ) final String name ){
102104

103105
@RequestMapping( method = RequestMethod.POST )
104106
@ResponseStatus( HttpStatus.CREATED )
105-
// @Secured( SecurityConstants.PRIVILEGE_USER_WRITE )
106107
public void create( @RequestBody final User resource, final UriComponentsBuilder uriBuilder, final HttpServletResponse response ){
107108
createInternal( resource, uriBuilder, response );
108109
}
@@ -111,7 +112,7 @@ public void create( @RequestBody final User resource, final UriComponentsBuilder
111112

112113
@RequestMapping( method = RequestMethod.PUT )
113114
@ResponseStatus( HttpStatus.OK )
114-
// @Secured( SecurityConstants.CAN_USER_WRITE )
115+
@Secured( SecurityConstants.CAN_USER_WRITE )
115116
public void update( @RequestBody final User resource ){
116117
updateInternal( resource );
117118
}
@@ -120,7 +121,7 @@ public void update( @RequestBody final User resource ){
120121

121122
@RequestMapping( value = "/{id}",method = RequestMethod.DELETE )
122123
@ResponseStatus( HttpStatus.NO_CONTENT )
123-
// @Secured( SecurityConstants.CAN_USER_WRITE )
124+
@Secured( SecurityConstants.CAN_USER_WRITE )
124125
public void delete( @PathVariable( "id" ) final Long id ){
125126
deleteByIdInternal( id );
126127
}

‎src/test/java/org/rest/sec/web/role/RoleSortRESTIntegrationTest.java‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.rest.sec.client.template.RoleRESTTemplateImpl;
44
import org.rest.sec.model.Role;
55
import org.rest.sec.test.SecSortRESTIntegrationTest;
6+
import org.rest.util.order.OrderByName;
67
import org.springframework.beans.factory.annotation.Autowired;
78

89
import com.google.common.collect.Ordering;
@@ -32,12 +33,7 @@ protected final RoleRESTTemplateImpl getAPI(){
3233

3334
@Override
3435
protected final Ordering< Role > getOrdering(){
35-
return new Ordering< Role >(){
36-
@Override
37-
public final int compare( final Role left, final Role right ){
38-
return left.getName().compareToIgnoreCase( right.getName() );
39-
}
40-
};
36+
return new OrderByName< Role >();
4137
}
4238

4339
}

0 commit comments

Comments
 (0)