@Test public void test_extractIp() { RangerIpMatcher matcher = new RangerIpMatcher(); Assert.assertNull(matcher.extractIp(null)); RangerAccessRequest request = mock(RangerAccessRequest.class); when(request.getClientIPAddress()).thenReturn(null); Assert.assertNull(matcher.extractIp(request)); when(request.getClientIPAddress()).thenReturn("anIp"); Assert.assertEquals("anIp", matcher.extractIp(request)); }
String extractIp(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.extractIp(" + request+ ")"); } String ip = null; if (request == null) { LOG.debug("isMatched: Unexpected: null request object!"); } else { ip = request.getClientIPAddress(); if (ip == null) { LOG.debug("isMatched: Unexpected: Client ip in request object is null!"); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.extractIp(" + request+ "): " + ip); } return ip; }
RangerIpMatcher extends RangerAbstractConditionEvaluator { String extractIp(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.extractIp(" + request+ ")"); } String ip = null; if (request == null) { LOG.debug("isMatched: Unexpected: null request object!"); } else { ip = request.getClientIPAddress(); if (ip == null) { LOG.debug("isMatched: Unexpected: Client ip in request object is null!"); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.extractIp(" + request+ "): " + ip); } return ip; } }
RangerIpMatcher extends RangerAbstractConditionEvaluator { String extractIp(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.extractIp(" + request+ ")"); } String ip = null; if (request == null) { LOG.debug("isMatched: Unexpected: null request object!"); } else { ip = request.getClientIPAddress(); if (ip == null) { LOG.debug("isMatched: Unexpected: Client ip in request object is null!"); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.extractIp(" + request+ "): " + ip); } return ip; }  }
RangerIpMatcher extends RangerAbstractConditionEvaluator { String extractIp(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.extractIp(" + request+ ")"); } String ip = null; if (request == null) { LOG.debug("isMatched: Unexpected: null request object!"); } else { ip = request.getClientIPAddress(); if (ip == null) { LOG.debug("isMatched: Unexpected: Client ip in request object is null!"); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.extractIp(" + request+ "): " + ip); } return ip; }  @Override void init(); @Override boolean isMatched(final RangerAccessRequest request); }
RangerIpMatcher extends RangerAbstractConditionEvaluator { String extractIp(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.extractIp(" + request+ ")"); } String ip = null; if (request == null) { LOG.debug("isMatched: Unexpected: null request object!"); } else { ip = request.getClientIPAddress(); if (ip == null) { LOG.debug("isMatched: Unexpected: Client ip in request object is null!"); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.extractIp(" + request+ "): " + ip); } return ip; }  @Override void init(); @Override boolean isMatched(final RangerAccessRequest request);  }