@Test public void testMeetsCriteriaWithNullResult() { SnmpValue result = null; assertFalse(monitor.meetsCriteria(result, null, null)); }
public boolean meetsCriteria(SnmpValue result, String operator, String operand) { Boolean retVal = null; retVal = isCriteriaNull(result, operator, operand); if (retVal == null) { String value = getStringValue(result); retVal = checkStringCriteria(operator, operand, value); if (retVal == null) { BigInteger val = BigInteger.valueOf(result.toLong()); BigInteger intOperand = new BigInteger(operand); if (LESS_THAN.equals(operator)) { return val.compareTo(intOperand) < 0; } else if (LESS_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) <= 0; } else if (GREATER_THAN.equals(operator)) { return val.compareTo(intOperand) > 0; } else if (GREATER_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) >= 0; } else { throw new IllegalArgumentException("operator " + operator + " is unknown"); } } } else if (retVal.booleanValue()) { return true; } return retVal.booleanValue(); }
SnmpMonitorStrategy extends AbstractServiceMonitor { public boolean meetsCriteria(SnmpValue result, String operator, String operand) { Boolean retVal = null; retVal = isCriteriaNull(result, operator, operand); if (retVal == null) { String value = getStringValue(result); retVal = checkStringCriteria(operator, operand, value); if (retVal == null) { BigInteger val = BigInteger.valueOf(result.toLong()); BigInteger intOperand = new BigInteger(operand); if (LESS_THAN.equals(operator)) { return val.compareTo(intOperand) < 0; } else if (LESS_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) <= 0; } else if (GREATER_THAN.equals(operator)) { return val.compareTo(intOperand) > 0; } else if (GREATER_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) >= 0; } else { throw new IllegalArgumentException("operator " + operator + " is unknown"); } } } else if (retVal.booleanValue()) { return true; } return retVal.booleanValue(); } }
SnmpMonitorStrategy extends AbstractServiceMonitor { public boolean meetsCriteria(SnmpValue result, String operator, String operand) { Boolean retVal = null; retVal = isCriteriaNull(result, operator, operand); if (retVal == null) { String value = getStringValue(result); retVal = checkStringCriteria(operator, operand, value); if (retVal == null) { BigInteger val = BigInteger.valueOf(result.toLong()); BigInteger intOperand = new BigInteger(operand); if (LESS_THAN.equals(operator)) { return val.compareTo(intOperand) < 0; } else if (LESS_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) <= 0; } else if (GREATER_THAN.equals(operator)) { return val.compareTo(intOperand) > 0; } else if (GREATER_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) >= 0; } else { throw new IllegalArgumentException("operator " + operator + " is unknown"); } } } else if (retVal.booleanValue()) { return true; } return retVal.booleanValue(); }  }
SnmpMonitorStrategy extends AbstractServiceMonitor { public boolean meetsCriteria(SnmpValue result, String operator, String operand) { Boolean retVal = null; retVal = isCriteriaNull(result, operator, operand); if (retVal == null) { String value = getStringValue(result); retVal = checkStringCriteria(operator, operand, value); if (retVal == null) { BigInteger val = BigInteger.valueOf(result.toLong()); BigInteger intOperand = new BigInteger(operand); if (LESS_THAN.equals(operator)) { return val.compareTo(intOperand) < 0; } else if (LESS_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) <= 0; } else if (GREATER_THAN.equals(operator)) { return val.compareTo(intOperand) > 0; } else if (GREATER_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) >= 0; } else { throw new IllegalArgumentException("operator " + operator + " is unknown"); } } } else if (retVal.booleanValue()) { return true; } return retVal.booleanValue(); }  abstract PollStatus poll(MonitoredService svc, Map<String, Object> parameters); String getStringValue(SnmpValue result); boolean meetsCriteria(SnmpValue result, String operator, String operand); }
SnmpMonitorStrategy extends AbstractServiceMonitor { public boolean meetsCriteria(SnmpValue result, String operator, String operand) { Boolean retVal = null; retVal = isCriteriaNull(result, operator, operand); if (retVal == null) { String value = getStringValue(result); retVal = checkStringCriteria(operator, operand, value); if (retVal == null) { BigInteger val = BigInteger.valueOf(result.toLong()); BigInteger intOperand = new BigInteger(operand); if (LESS_THAN.equals(operator)) { return val.compareTo(intOperand) < 0; } else if (LESS_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) <= 0; } else if (GREATER_THAN.equals(operator)) { return val.compareTo(intOperand) > 0; } else if (GREATER_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) >= 0; } else { throw new IllegalArgumentException("operator " + operator + " is unknown"); } } } else if (retVal.booleanValue()) { return true; } return retVal.booleanValue(); }  abstract PollStatus poll(MonitoredService svc, Map<String, Object> parameters); String getStringValue(SnmpValue result); boolean meetsCriteria(SnmpValue result, String operator, String operand);  }