FruIdEventsHelperUtil { public static List<Event> addFruIDtoHostEvents( List<Event> aggregatedEvents, String serverFruID ) { List<Event> events = new ArrayList<Event>(); try { for ( int i = 0; i < aggregatedEvents.size(); i++ ) { Event event = aggregatedEvents.get( i ); Map<String, String> eventBody = event.getBody().getData(); eventBody.put( "fruID", serverFruID ); events.add( event ); } return events; } catch ( Exception e ) { logger.error( "HMS aggregator error in adding Fru ID to Host or BMC or SYSTEM Events", e ); } return null; }  static List<Event> addFruIDtoEvents( List<Event> aggregatedEvents, String nodeID,
                                                ServerComponent serverComponent ); static List<Event> addFruIDtoSwitchEventsHelper( List<Event> aggregatedSwitchEvents, String switchID ); static List<Event> addFruIDtoCpuEvents( List<Event> aggregatedEvents, List<CpuInfo> cpuInfoList ); static List<Event> addFruIDtoMemoryEvents( List<Event> aggregatedEvents, List<MemoryInfo> memoryInfoList ); static List<Event> addFruIDtoStorageEvents( List<Event> aggregatedEvents, List<StorageInfo> storageInfoList ); static List<Event> addFruIDtoStorageControllerEvents( List<Event> aggregatedEvents,
                                                                 List<StorageController> storageControllerList ); static List<Event> addFruIDtoEthernetControllerEvents( List<Event> aggregatedEvents,
                                                                  List<EthernetController> ethernetControllerList ); static List<Event> addFruIDtoHostEvents( List<Event> aggregatedEvents, String serverFruID ); static List<Event> addFruIDtoSwitchEvents( List<Event> aggregatedEvents, String switchFruID );  }
@Test public void addFruIDtoHostEventsTest() { List<Event> events = new ArrayList<Event>(); List<Event> hostEventsFruID = new ArrayList<Event>(); Event event = new Event(); Body body = new Body(); Header header = new Header(); try { body.setDescription( "System Status for rack EVO:RACK node N5 System PCIe Slot1 health StateDeasserted" ); Map<String, String> data = new HashMap<String, String>(); data.put( "unit", "DISCRETE" ); data.put( "eventName", "SYSTEM_STATUS" ); body.setData( data ); Map<EventComponent, String> compIdentifier = new HashMap<EventComponent, String>(); compIdentifier.put( EventComponent.SYSTEM, "PCIe Slot1" ); compIdentifier.put( EventComponent.SERVER, "N5" ); header.addComponentIdentifier( compIdentifier ); header.setAgent( "HMS" ); header.setSeverity( EventSeverity.INFORMATIONAL ); header.setVersion( "1.0" ); event.setBody( body ); event.setHeader( header ); events.add( event ); String serverFruID = "1676845885"; hostEventsFruID = FruIdEventsHelperUtil.addFruIDtoHostEvents( events, serverFruID ); Map<String, String> eventData = hostEventsFruID.get( 0 ).getBody().getData(); assertNotNull( eventData.get( "fruID" ) ); } catch ( Exception e ) { logger.info( "Integrate FRU ID with Host Events Test Failed" ); } }