HMSLocalServerRestService { @RequestMapping( value = "/{host_id}/storagecontrollerinfo", method = RequestMethod.GET ) public @ResponseBody List<StorageController> getStorageControllerInfo( @PathVariable String host_id ) throws HMSRestException { List<StorageController> listStorageController = new ArrayList<StorageController>(); try { if ( !InventoryLoader.getInstance().getNodeMap().containsKey( host_id ) ) throw new HMSRestException( Status.NOT_FOUND.getStatusCode(), "Invalid Request", "Can't find host with id " + host_id ); else { ServerNode node = InventoryLoader.getInstance().getNodeMap().get( host_id ); ServerComponentAggregator aggregator = new ServerComponentAggregator(); aggregator.setServerComponentInfo( node, ServerComponent.STORAGE_CONTROLLER ); listStorageController = ServerInfoHelperUtil.convertToFruStorageControllerInfo( node ); context.publishEvent( new FruDataChangeMessage( (List<FruComponent>) (List<?>) listStorageController, host_id, ServerComponent.STORAGE_CONTROLLER ) ); return listStorageController; } } catch ( HmsException e ) { if ( e instanceof HMSRestException ) { logger.error( "Error while getting Storage Controller Info for Node: {}.", host_id, e ); throw (HMSRestException) e; } else { logger.error( "Error while getting Storage Controller Info for Node: {}.", host_id, e ); throw new HMSRestException( Status.INTERNAL_SERVER_ERROR.getStatusCode(), "Server Error", e.getMessage() ); } } catch ( Exception e ) { logger.error( "Error while getting Storage Controller Info for Node: {}.", host_id, e ); throw new HMSRestException( Status.INTERNAL_SERVER_ERROR.getStatusCode(), "Server Error", e.getMessage() ); } }  @RequestMapping( value = { "/{host_id}/selftest", "/{host_id}/bmcusers", "/{host_id}/acpipowerstate", "/{host_id}/bootoptions", "/{host_id}/remoteconsoledetails", "/{host_id}/startremoteconsole" }, method = RequestMethod.GET ) @ResponseBody ResponseEntity<Object> getMirrorHostInfo( @RequestBody( required = false ) String body, HttpMethod method,
                                                     HttpServletRequest request, HttpServletResponse response ); @RequestMapping( value = { "", "/" }, method = RequestMethod.GET ) @ResponseBody Map<String, ServerNode> getAllServerNodes( @RequestBody( required = false ) String body, HttpMethod method,
                                                      HttpServletRequest request, HttpServletResponse response ); @RequestMapping( value = { "/jnlpRemoteConsoleSupportFiles/{host_id}/**" }, method = RequestMethod.GET ) @ResponseBody void getRemoteConsoleJnlpSupportFiles( HttpServletRequest request, HttpServletResponse response ); @RequestMapping( value = "/{host_id}", method = RequestMethod.GET ) @ResponseBody ServerInfo getHostInfo( @PathVariable String host_id ); @RequestMapping( value = "/{host_id}/powerstatus", method = RequestMethod.GET ) @ResponseBody ServerNodePowerStatus getHostPowerStatus( @PathVariable String host_id ); @RequestMapping( value = "/{hostId}/portname", method = RequestMethod.GET ) @ResponseBody String getPortName( @PathVariable String hostId ); @RequestMapping( value = "/{host_id}/cpuinfo", method = RequestMethod.GET ) @ResponseBody List<CpuInfo> getCpuInfo( @PathVariable String host_id ); @RequestMapping( value = "/{host_id}/storageinfo", method = RequestMethod.GET ) @ResponseBody List<StorageInfo> getHddInfo( @PathVariable String host_id ); @RequestMapping( value = "/{host_id}/storagecontrollerinfo", method = RequestMethod.GET ) @ResponseBody List<StorageController> getStorageControllerInfo( @PathVariable String host_id ); @RequestMapping( value = "/{host_id}/memoryinfo", method = RequestMethod.GET ) @ResponseBody List<MemoryInfo> getMemoryInfo( @PathVariable String host_id ); @RequestMapping( value = "/{host_id}/nicinfo", method = RequestMethod.GET ) @ResponseBody List<EthernetController> getNicInfo( @PathVariable String host_id ); @RequestMapping( value = { "/{host_id}/bootoptions", "/{host_id}/chassisidentify", "/{host_id}/selinfo" }, method = RequestMethod.PUT ) @ResponseBody ResponseEntity<Object> putMirrorHostInfo( @RequestBody( required = false ) String body, HttpMethod method,
                                                     HttpServletRequest request, HttpServletResponse response ); @RequestMapping( value = { "/{host_id}" }, method = RequestMethod.PUT ) @ResponseBody ResponseEntity<Object> updateNode( @PathVariable String host_id,
                                                            @RequestParam( "action" ) String action,
                                                            @RequestBody( required = false ) String body,
                                                            HttpMethod method, HttpServletRequest request,
                                                            HttpServletResponse response ); @RequestMapping( value = { "/{host_id}/bmcPassword" }, method = RequestMethod.PUT ) @ResponseBody ResponseEntity<BaseResponse> updateBmcPassword( @PathVariable String host_id,
                                                                         @RequestBody String newPassword ); @RequestMapping( value = { "/{hostId}" }, method = RequestMethod.DELETE ) ResponseEntity<BaseResponse> removeServer( @PathVariable String hostId );  }
@Test( expected = HMSRestException.class ) public void getStorageControllerInfo() throws Throwable { MvcResult result; try { result = this.mockMvc.perform( get( "http: } catch ( Exception e ) { assertNotNull( e ); assertNotNull( e.getCause() ); assertTrue( e.getCause() instanceof HMSRestException ); throw e.getCause(); } assertNotNull( result.getResponse() ); }