/** * Checks if the method name is not allowed against the configuration. * * @param methodName the method name * * @throws org.finra.herd.model.MethodNotAllowedException if requested method is not allowed. */ public void checkNotAllowedMethod(String methodName) throws MethodNotAllowedException { boolean needToBlock = false; ConfigurationEntity configurationEntity = configurationDao.getConfigurationByKey(ConfigurationValue.NOT_ALLOWED_HERD_ENDPOINTS.getKey()); if (configurationEntity != null && StringUtils.isNotBlank(configurationEntity.getValueClob())) { List<String> methodsToBeBlocked = herdStringHelper.splitStringWithDefaultDelimiter(configurationEntity.getValueClob()); needToBlock = methodsToBeBlocked.contains(methodName); } if (needToBlock) { throw new MethodNotAllowedException("The requested method is not allowed."); } }
/** * Checks if the method name is not allowed against the configuration. * * @param methodName the method name * * @throws org.finra.herd.model.MethodNotAllowedException if requested method is not allowed. */ public void checkNotAllowedMethod(String methodName) throws MethodNotAllowedException { boolean needToBlock = false; ConfigurationEntity configurationEntity = configurationDao.getConfigurationByKey(ConfigurationValue.NOT_ALLOWED_HERD_ENDPOINTS.getKey()); if (configurationEntity != null && StringUtils.isNotBlank(configurationEntity.getValueClob())) { List<String> methodsToBeBlocked = herdStringHelper.splitStringWithDefaultDelimiter(configurationEntity.getValueClob()); needToBlock = methodsToBeBlocked.contains(methodName); } if (needToBlock) { throw new MethodNotAllowedException("The requested method is not allowed."); } }
@Test public void testHandleOperationNotAllowedFound() throws Exception { validateErrorInformation(exceptionHandler.handleOperationNotAllowedException(new MethodNotAllowedException(MESSAGE)), HttpStatus.METHOD_NOT_ALLOWED); }