test_class.declarator: ROLE_URL = "/Role/"
test_class.modifier: private static final
test_class.original_string: private static final String ROLE_URL = "/Role/";
test_class.type: String
test_class.var_name: ROLE_URL
test_class.declarator: wac
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private WebApplicationContext wac;
test_class.type: WebApplicationContext
test_class.var_name: wac
test_class.declarator: springSecurityFilterChain
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private Filter springSecurityFilterChain;
test_class.type: Filter
test_class.var_name: springSecurityFilterChain
test_class.declarator: dozerMapper
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private DtoMapper dozerMapper;
test_class.type: DtoMapper
test_class.var_name: dozerMapper
test_class.declarator: oadrUserService
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private OadrUserService oadrUserService;
test_class.type: OadrUserService
test_class.var_name: oadrUserService
test_class.declarator: oadrAppService
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private OadrAppService oadrAppService;
test_class.type: OadrAppService
test_class.var_name: oadrAppService
test_class.declarator: venService
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private VenService venService;
test_class.type: VenService
test_class.var_name: venService
test_class.declarator: mockMvc
test_class.modifier: private
test_class.original_string: private MockMvc mockMvc;
test_class.type: MockMvc
test_class.var_name: mockMvc
test_class.declarator: adminUser = null
test_class.modifier: private
test_class.original_string: private OadrUser adminUser = null;
test_class.type: OadrUser
test_class.var_name: adminUser
test_class.declarator: appUser = null
test_class.modifier: private
test_class.original_string: private OadrApp appUser = null;
test_class.type: OadrApp
test_class.var_name: appUser
test_class.declarator: venUser = null
test_class.modifier: private
test_class.original_string: private Ven venUser = null;
test_class.type: Ven
test_class.var_name: venUser
test_class.declarator: admin = SecurityMockMvcRequestPostProcessors.user("admin").roles("ADMIN")
test_class.modifier: private
test_class.original_string: private UserRequestPostProcessor admin = SecurityMockMvcRequestPostProcessors.user("admin").roles("ADMIN");
test_class.type: UserRequestPostProcessor
test_class.var_name: admin
test_class.declarator: user = SecurityMockMvcRequestPostProcessors.user("user").roles("USER")
test_class.modifier: private
test_class.original_string: private UserRequestPostProcessor user = SecurityMockMvcRequestPostProcessors.user("user").roles("USER");
test_class.type: UserRequestPostProcessor
test_class.var_name: user
test_class.declarator: ven = SecurityMockMvcRequestPostProcessors.user("ven").roles("VEN")
test_class.modifier: private
test_class.original_string: private UserRequestPostProcessor ven = SecurityMockMvcRequestPostProcessors.user("ven").roles("VEN");
test_class.type: UserRequestPostProcessor
test_class.var_name: ven
test_class.file: OpenADRServerVTNCommon/src/test/java/com/avob/openadr/server/common/vtn/controller/RoleControllerTest.java
test_class.identifier: RoleControllerTest
test_case.body: @Test
  	public void getUserRoleTest() throws Exception {
  		this.mockMvc.perform(
  				MockMvcRequestBuilders.post(ROLE_URL + "admin").header("Content-Type", "application/json").with(user))
  				.andExpect(MockMvcResultMatchers.status().is(HttpStatus.FORBIDDEN_403));
  		
  		this.mockMvc.perform(
  				MockMvcRequestBuilders.post(ROLE_URL + "admin").header("Content-Type", "application/json").with(ven))
  				.andExpect(MockMvcResultMatchers.status().is(HttpStatus.FORBIDDEN_403));
  
  		this.mockMvc.perform(MockMvcRequestBuilders.post(ROLE_URL + "mouaiccool")
  				.header("Content-Type", "application/json").with(admin))
  				.andExpect(MockMvcResultMatchers.status().is(HttpStatus.NOT_FOUND_404));
  
  		MvcResult andReturn = this.mockMvc.perform(
  				MockMvcRequestBuilders.post(ROLE_URL + "admin").header("Content-Type", "application/json").with(admin))
  				.andExpect(MockMvcResultMatchers.status().is(HttpStatus.OK_200)).andReturn();
  		assertTrue(andReturn.getResponse().getContentAsString().contains("ROLE_ADMIN"));
  		assertTrue(andReturn.getResponse().getContentAsString().contains("ROLE_USER"));
  
  		andReturn = this.mockMvc.perform(
  				MockMvcRequestBuilders.post(ROLE_URL + "app").header("Content-Type", "application/json").with(admin))
  				.andExpect(MockMvcResultMatchers.status().is(HttpStatus.OK_200)).andReturn();
  		assertTrue(andReturn.getResponse().getContentAsString().contains("ROLE_APP"));
  		assertTrue(andReturn.getResponse().getContentAsString().contains("ROLE_DEVICE_MANAGER"));
  
  		andReturn = this.mockMvc.perform(
  				MockMvcRequestBuilders.post(ROLE_URL + "ven").header("Content-Type", "application/json").with(admin))
  				.andExpect(MockMvcResultMatchers.status().is(HttpStatus.OK_200)).andReturn();
  		assertTrue(andReturn.getResponse().getContentAsString().contains("ROLE_VEN"));
  	}
test_case.class_method_signature: RoleControllerTest.getUserRoleTest()
test_case.full_signature: @Test public void getUserRoleTest()
test_case.identifier: getUserRoleTest
test_case.invocations: andExpect perform with header post is status andExpect perform with header post is status andExpect perform with header post is status andReturn andExpect perform with header post is status assertTrue contains getContentAsString getResponse assertTrue contains getContentAsString getResponse andReturn andExpect perform with header post is status assertTrue contains getContentAsString getResponse assertTrue contains getContentAsString getResponse andReturn andExpect perform with header post is status assertTrue contains getContentAsString getResponse
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getUserRoleTest()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(RoleController.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(RoleController.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: abstractUserDao
focal_class.modifier: @Resource
  	private
focal_class.original_string: @Resource
  	private AbstractUserDao abstractUserDao;
focal_class.type: AbstractUserDao
focal_class.var_name: abstractUserDao
focal_class.file: OpenADRServerVTNCommon/src/main/java/com/avob/openadr/server/common/vtn/controller/RoleController.java
focal_class.identifier: RoleController
focal_class.class_method_signature: RoleController.getUserRole(@PathVariable("username") String username, HttpServletResponse response)
focal_class.full_signature: @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM') or hasRole('ROLE_VTN') or hasRole('ROLE_XMPP')") @RequestMapping(value = "/{username}", method = RequestMethod.POST) @ResponseBody public List<String> getUserRole(@PathVariable("username") String username, HttpServletResponse response)
focal_class.identifier: getUserRole
focal_class.modifiers: @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM') or hasRole('ROLE_VTN') or hasRole('ROLE_XMPP')") @RequestMapping(value = "/{username}", method = RequestMethod.POST) @ResponseBody public
focal_class.parameters: (@PathVariable("username") String username, HttpServletResponse response)
focal_class.return: List<String>
focal_class.signature: List<String> getUserRole(@PathVariable("username") String username, HttpServletResponse response)
focal_method.body: @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM') or hasRole('ROLE_VTN') or hasRole('ROLE_XMPP')")
  	@RequestMapping(value = "/{username}", method = RequestMethod.POST)
  	@ResponseBody
  	public List<String> getUserRole(@PathVariable("username") String username, HttpServletResponse response) {
  		AbstractUser user = abstractUserDao.findOneByUsername(username);
  		List<String> roles = new ArrayList<>();
  		if (user == null) {
  			response.setStatus(HttpStatus.NOT_FOUND_404);
  			return roles;
  		}
  		roles = user.getRoles();
  
  		if (user instanceof Ven) {
  			roles.add("ROLE_VEN");
  		} else if (user instanceof OadrUser) {
  			roles.add("ROLE_USER");
  		} else if (user instanceof OadrApp) {
  			roles.add("ROLE_APP");
  		}
  
  		LOGGER.info(user.toString() + " roles: " + roles.toString());
  
  		return roles;
  	}
focal_method.class_method_signature: RoleController.getUserRole(@PathVariable("username") String username, HttpServletResponse response)
focal_method.full_signature: @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM') or hasRole('ROLE_VTN') or hasRole('ROLE_XMPP')") @RequestMapping(value = "/{username}", method = RequestMethod.POST) @ResponseBody public List<String> getUserRole(@PathVariable("username") String username, HttpServletResponse response)
focal_method.identifier: getUserRole
focal_method.invocations: findOneByUsername setStatus getRoles add add add info toString toString
focal_method.modifiers: @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM') or hasRole('ROLE_VTN') or hasRole('ROLE_XMPP')") @RequestMapping(value = "/{username}", method = RequestMethod.POST) @ResponseBody public
focal_method.parameters: (@PathVariable("username") String username, HttpServletResponse response)
focal_method.return: List<String>
focal_method.signature: List<String> getUserRole(@PathVariable("username") String username, HttpServletResponse response)