FruIdGeneratorUtil { public static String generateFruIdHashCode( ComponentIdentifier componentIdentifier, String location ) { String hash = "0"; try { if ( componentIdentifier != null ) { if ( componentIdentifier.getManufacturer() != null ) { hash = String.valueOf( componentIdentifier.getManufacturer().hashCode() ); } if ( componentIdentifier.getProduct() != null ) { hash = hash.concat( String.valueOf( componentIdentifier.getProduct().hashCode() ) ); } if ( componentIdentifier.getPartNumber() != null ) { hash = hash.concat( String.valueOf( componentIdentifier.getPartNumber().hashCode() ) ); } if ( componentIdentifier.getSerialNumber() != null ) { hash = hash.concat( String.valueOf( componentIdentifier.getSerialNumber().hashCode() ) ); } } if ( location != null ) { hash = hash.concat( String.valueOf( location.hashCode() ) ); } return String.valueOf( hash.hashCode() ); } catch ( Exception e ) { logger.error( " Error while generating the FRU ID {} ", componentIdentifier, location, e ); } return hash; }  static String generateFruIdHashCode( ComponentIdentifier componentIdentifier, String location ); static String generateFruIdHashCodeServerComponent( String fruId, String serverFruId ); static String generateFruIdHashCodeServerComponent( String fruId, String serverFruId,
                                                               String uniqueFruProperty );  }
@Test public void serverFruIDGeneration() { logger.info( "Testing hmsutil FruIdGeneratorUtilTest" ); ComponentIdentifier componentIdentifier = new ComponentIdentifier(); try { componentIdentifier.setManufacturer( "DELL" ); componentIdentifier.setProduct( "PowerEdge R630" ); componentIdentifier.setPartNumber( "0CNCJWX36" ); componentIdentifier.setSerialNumber( "CN747514550128" ); String location = "2U"; String fruID = FruIdGeneratorUtil.generateFruIdHashCode( componentIdentifier, location ); assertNotNull( fruID ); } catch ( Exception e ) { logger.info( "Test hmsutil FruIdGeneratorUtilTest Failed" ); e.printStackTrace(); } }
@Test public void memoryFruIDGeneration() { logger.info( "Testing hmsutil FruIdGeneratorUtilTest: Memory Fru ID generation" ); ComponentIdentifier componentIdentifier = new ComponentIdentifier(); try { componentIdentifier.setManufacturer( "Samsung" ); componentIdentifier.setPartNumber( "M393B2G70QH0-YK0" ); componentIdentifier.setSerialNumber( "1222EB94" ); String location = "ChannelA_Dimm0"; String fruID = FruIdGeneratorUtil.generateFruIdHashCode( componentIdentifier, location ); assertNotNull( fruID ); } catch ( Exception e ) { logger.info( "Test hmsutil FruIdGeneratorUtilTest Failed" ); e.printStackTrace(); } }
@Test public void memoryFruIDGeneration2() { logger.info( "Testing hmsutil FruIdGeneratorUtilTest: Memory Fru ID generation" ); ComponentIdentifier componentIdentifier = new ComponentIdentifier(); try { componentIdentifier.setManufacturer( "Samsung" ); componentIdentifier.setPartNumber( "M393B2G70QH0-YK0" ); componentIdentifier.setSerialNumber( "1222EB93" ); String location = "ChannelA_Dimm1"; String fruID = FruIdGeneratorUtil.generateFruIdHashCode( componentIdentifier, location ); assertNotNull( fruID ); } catch ( Exception e ) { logger.info( "Test hmsutil FruIdGeneratorUtilTest Failed" ); e.printStackTrace(); } }
@Test public void memoryFruIDGeneration3() { logger.info( "Testing hmsutil FruIdGeneratorUtilTest: Memory Fru ID generation" ); ComponentIdentifier componentIdentifier = new ComponentIdentifier(); try { componentIdentifier.setManufacturer( "Samsung" ); componentIdentifier.setPartNumber( "M393B2G70QH0-YK0" ); componentIdentifier.setSerialNumber( "1222EAE6" ); String location = "ChannelE_Dimm0"; String fruID = FruIdGeneratorUtil.generateFruIdHashCode( componentIdentifier, location ); assertNotNull( fruID ); } catch ( Exception e ) { logger.info( "Test hmsutil FruIdGeneratorUtilTest Failed" ); e.printStackTrace(); } }
@Test public void memoryFruIDGeneration4() { logger.info( "Testing hmsutil FruIdGeneratorUtilTest: Memory Fru ID generation" ); ComponentIdentifier componentIdentifier = new ComponentIdentifier(); try { componentIdentifier.setManufacturer( "Samsung" ); componentIdentifier.setPartNumber( "M393B2G70QH0-YK0" ); componentIdentifier.setSerialNumber( "1222EAE5" ); String location = "ChannelE_Dimm1"; String fruID = FruIdGeneratorUtil.generateFruIdHashCode( componentIdentifier, location ); assertNotNull( fruID ); } catch ( Exception e ) { logger.info( "Test hmsutil FruIdGeneratorUtilTest Failed" ); e.printStackTrace(); } }