HddInfoHelper { public static boolean isSmartDataBeyondThreshold( HddSMARTData hddSMARTData, boolean isValueGreaterThanThresholdConcerning ) { boolean isDataConcerning = false; if ( hddSMARTData != null ) { String thresholdString = hddSMARTData.getThreshold(); String valueString = hddSMARTData.getValue(); if ( valueString != null ) { if ( thresholdString != null ) { Integer value = null; Integer threshold = null; try { value = Integer.parseInt( valueString ); threshold = Integer.parseInt( thresholdString ); } catch ( Exception e ) { return false; } if ( isValueGreaterThanThresholdConcerning ) { if ( value >= threshold && threshold != 0 ) { isDataConcerning = true; } } else { if ( value <= threshold && threshold != 0 ) { isDataConcerning = true; } } } } } return isDataConcerning; }  static List<HddInfo> getHddInfo( HostSystem hostSystem, VsphereClient client, ServiceServerNode node ); static boolean findIsCapacityDisk( String deviceCanonicalName, Session session, String nodeId,
                                              String diskType ); static List<HddSMARTData> getHddSmartDataInfo( String diskName, Session session ); static Session getSession( ServiceServerNode node ); static void destroySession( Session session ); static List<ServerComponentEvent> getHddSensor( ServiceHmsNode serviceNode, ServerComponent component,
                                                           InbandServiceImpl inbandServiceImpl ); static List<ServerComponentEvent> getHddOperationalStateEvents( List<HddInfo> hddInfoList,
                                                                           ServiceHmsNode serviceNode ); static boolean isSmartDataBeyondThreshold( HddSMARTData hddSMARTData,
                                                      boolean isValueGreaterThanThresholdConcerning );  }
@Test public void testSmartDataThreshold() { logger.info( "Testing hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold" ); try { HddSMARTData hddSMARTData = new HddSMARTData(); hddSMARTData.setParameter( "Raw Read Error Rate" ); hddSMARTData.setValue( "10" ); hddSMARTData.setThreshold( "11" ); hddSMARTData.setWorst( "0" ); boolean isDataConcerning = HddInfoHelper.isSmartDataBeyondThreshold( hddSMARTData, false ); assertTrue( isDataConcerning ); } catch ( Exception e ) { logger.info( "Test hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold Failed" ); e.printStackTrace(); } }
@Test public void testSmartDataThreshold1() { logger.info( "Testing hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold1" ); try { HddSMARTData hddSMARTData = new HddSMARTData(); hddSMARTData.setParameter( "Raw Read Error Rate" ); hddSMARTData.setValue( "0" ); hddSMARTData.setThreshold( "0" ); hddSMARTData.setWorst( "0" ); boolean isDataConcerning = HddInfoHelper.isSmartDataBeyondThreshold( hddSMARTData, false ); assertFalse( isDataConcerning ); } catch ( Exception e ) { logger.info( "Test hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold1 Failed" ); e.printStackTrace(); } }
@Test public void testSmartDataThreshold2() { logger.info( "Testing hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold2" ); try { HddSMARTData hddSMARTData = new HddSMARTData(); hddSMARTData.setParameter( "Raw Read Error Rate" ); hddSMARTData.setValue( "10" ); hddSMARTData.setThreshold( "0" ); hddSMARTData.setWorst( "0" ); boolean isDataConcerning = HddInfoHelper.isSmartDataBeyondThreshold( hddSMARTData, false ); assertFalse( isDataConcerning ); } catch ( Exception e ) { logger.info( "Test hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold2 Failed" ); e.printStackTrace(); } }
@Test public void testSmartDataThreshold3() { logger.info( "Testing hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold3" ); try { HddSMARTData hddSMARTData = new HddSMARTData(); hddSMARTData.setParameter( "Raw Read Error Rate" ); hddSMARTData.setValue( "10" ); hddSMARTData.setThreshold( "N/A" ); hddSMARTData.setWorst( "0" ); boolean isDataConcerning = HddInfoHelper.isSmartDataBeyondThreshold( hddSMARTData, false ); assertFalse( isDataConcerning ); } catch ( Exception e ) { logger.info( "Test hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold3 Failed" ); e.printStackTrace(); } }
@Test public void testSmartDataThreshold4() { logger.info( "Testing hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold4" ); try { HddSMARTData hddSMARTData = new HddSMARTData(); hddSMARTData.setParameter( "Raw Read Error Rate" ); hddSMARTData.setValue( "N/A" ); hddSMARTData.setThreshold( "N/A" ); hddSMARTData.setWorst( "0" ); boolean isDataConcerning = HddInfoHelper.isSmartDataBeyondThreshold( hddSMARTData, false ); assertFalse( isDataConcerning ); } catch ( Exception e ) { logger.info( "Test hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold4 Failed" ); e.printStackTrace(); } }
@Test public void testSmartDataThreshold5() { logger.info( "Testing hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold5" ); try { HddSMARTData hddSMARTData = new HddSMARTData(); hddSMARTData.setParameter( "Raw Read Error Rate" ); hddSMARTData.setValue( "20" ); hddSMARTData.setThreshold( "20" ); hddSMARTData.setWorst( "0" ); boolean isDataConcerning = HddInfoHelper.isSmartDataBeyondThreshold( hddSMARTData, false ); assertTrue( isDataConcerning ); } catch ( Exception e ) { logger.info( "Test hms-inband HddInfoHelperTest::isSmartDataBeyondThreshold5 Failed" ); e.printStackTrace(); } }