@Test public void sqlStatementDataSearch() { SqlStatementData sqlData = new SqlStatementData(); sqlData.setMethodIdent(1L); sqlData.setSql("Select blah from table where condition"); SearchCriteria searchCriteria = new SearchCriteria("Blah"); SearchCriteria wrong = new SearchCriteria("halB"); searchCriteria.setCaseSensitive(false); assertThat(SearchFactory.isSearchCompatible(sqlData, searchCriteria, repositoryDefinition), is(equalTo(true))); searchCriteria.setCaseSensitive(true); assertThat(SearchFactory.isSearchCompatible(sqlData, searchCriteria, repositoryDefinition), is(equalTo(false))); assertThat(SearchFactory.isSearchCompatible(sqlData, wrong, repositoryDefinition), is(equalTo(false))); List<String> parameters = new ArrayList<>(); parameters.add("blah"); sqlData.setSql("Select somthing from table where condition=?"); sqlData.setParameterValues(parameters); searchCriteria.setCaseSensitive(false); assertThat(SearchFactory.isSearchCompatible(sqlData, searchCriteria, repositoryDefinition), is(equalTo(true))); searchCriteria.setCaseSensitive(true); assertThat(SearchFactory.isSearchCompatible(sqlData, searchCriteria, repositoryDefinition), is(equalTo(false))); assertThat(SearchFactory.isSearchCompatible(sqlData, wrong, repositoryDefinition), is(equalTo(false))); }
public static boolean isSearchCompatible(Object element, SearchCriteria searchCriteria, RepositoryDefinition repositoryDefinition) { if (null == element) { return false; } if (TimerData.class.equals(element.getClass()) || AggregatedTimerData.class.equals(element.getClass())) { return timerSearchFinder.isSearchCompatible((TimerData) element, searchCriteria, repositoryDefinition); } else if (SqlStatementData.class.equals(element.getClass()) || AggregatedSqlStatementData.class.equals(element.getClass())) { return sqlSearchFinder.isSearchCompatible((SqlStatementData) element, searchCriteria, repositoryDefinition); } else if (HttpTimerData.class.equals(element.getClass()) || AggregatedHttpTimerData.class.equals(element.getClass())) { return httpSearchFinder.isSearchCompatible((HttpTimerData) element, searchCriteria, repositoryDefinition); } else if (ExceptionSensorData.class.equals(element.getClass()) || AggregatedExceptionSensorData.class.equals(element.getClass())) { return exceptionSearchFinder.isSearchCompatible((ExceptionSensorData) element, searchCriteria, repositoryDefinition); } else if (InvocationSequenceData.class.equals(element.getClass())) { return invocationSearchFinder.isSearchCompatible((InvocationSequenceData) element, searchCriteria, repositoryDefinition); } else if (JmxSensorValueData.class.equals(element.getClass())) { return jmxSearchFinder.isSearchCompatible((JmxSensorValueData) element, searchCriteria, repositoryDefinition); } else if (Span.class.isAssignableFrom(element.getClass())) { return spanSearchFinder.isSearchCompatible((Span) element, searchCriteria, repositoryDefinition); } return false; }
SearchFactory { public static boolean isSearchCompatible(Object element, SearchCriteria searchCriteria, RepositoryDefinition repositoryDefinition) { if (null == element) { return false; } if (TimerData.class.equals(element.getClass()) || AggregatedTimerData.class.equals(element.getClass())) { return timerSearchFinder.isSearchCompatible((TimerData) element, searchCriteria, repositoryDefinition); } else if (SqlStatementData.class.equals(element.getClass()) || AggregatedSqlStatementData.class.equals(element.getClass())) { return sqlSearchFinder.isSearchCompatible((SqlStatementData) element, searchCriteria, repositoryDefinition); } else if (HttpTimerData.class.equals(element.getClass()) || AggregatedHttpTimerData.class.equals(element.getClass())) { return httpSearchFinder.isSearchCompatible((HttpTimerData) element, searchCriteria, repositoryDefinition); } else if (ExceptionSensorData.class.equals(element.getClass()) || AggregatedExceptionSensorData.class.equals(element.getClass())) { return exceptionSearchFinder.isSearchCompatible((ExceptionSensorData) element, searchCriteria, repositoryDefinition); } else if (InvocationSequenceData.class.equals(element.getClass())) { return invocationSearchFinder.isSearchCompatible((InvocationSequenceData) element, searchCriteria, repositoryDefinition); } else if (JmxSensorValueData.class.equals(element.getClass())) { return jmxSearchFinder.isSearchCompatible((JmxSensorValueData) element, searchCriteria, repositoryDefinition); } else if (Span.class.isAssignableFrom(element.getClass())) { return spanSearchFinder.isSearchCompatible((Span) element, searchCriteria, repositoryDefinition); } return false; } }
SearchFactory { public static boolean isSearchCompatible(Object element, SearchCriteria searchCriteria, RepositoryDefinition repositoryDefinition) { if (null == element) { return false; } if (TimerData.class.equals(element.getClass()) || AggregatedTimerData.class.equals(element.getClass())) { return timerSearchFinder.isSearchCompatible((TimerData) element, searchCriteria, repositoryDefinition); } else if (SqlStatementData.class.equals(element.getClass()) || AggregatedSqlStatementData.class.equals(element.getClass())) { return sqlSearchFinder.isSearchCompatible((SqlStatementData) element, searchCriteria, repositoryDefinition); } else if (HttpTimerData.class.equals(element.getClass()) || AggregatedHttpTimerData.class.equals(element.getClass())) { return httpSearchFinder.isSearchCompatible((HttpTimerData) element, searchCriteria, repositoryDefinition); } else if (ExceptionSensorData.class.equals(element.getClass()) || AggregatedExceptionSensorData.class.equals(element.getClass())) { return exceptionSearchFinder.isSearchCompatible((ExceptionSensorData) element, searchCriteria, repositoryDefinition); } else if (InvocationSequenceData.class.equals(element.getClass())) { return invocationSearchFinder.isSearchCompatible((InvocationSequenceData) element, searchCriteria, repositoryDefinition); } else if (JmxSensorValueData.class.equals(element.getClass())) { return jmxSearchFinder.isSearchCompatible((JmxSensorValueData) element, searchCriteria, repositoryDefinition); } else if (Span.class.isAssignableFrom(element.getClass())) { return spanSearchFinder.isSearchCompatible((Span) element, searchCriteria, repositoryDefinition); } return false; } private  SearchFactory(); }
SearchFactory { public static boolean isSearchCompatible(Object element, SearchCriteria searchCriteria, RepositoryDefinition repositoryDefinition) { if (null == element) { return false; } if (TimerData.class.equals(element.getClass()) || AggregatedTimerData.class.equals(element.getClass())) { return timerSearchFinder.isSearchCompatible((TimerData) element, searchCriteria, repositoryDefinition); } else if (SqlStatementData.class.equals(element.getClass()) || AggregatedSqlStatementData.class.equals(element.getClass())) { return sqlSearchFinder.isSearchCompatible((SqlStatementData) element, searchCriteria, repositoryDefinition); } else if (HttpTimerData.class.equals(element.getClass()) || AggregatedHttpTimerData.class.equals(element.getClass())) { return httpSearchFinder.isSearchCompatible((HttpTimerData) element, searchCriteria, repositoryDefinition); } else if (ExceptionSensorData.class.equals(element.getClass()) || AggregatedExceptionSensorData.class.equals(element.getClass())) { return exceptionSearchFinder.isSearchCompatible((ExceptionSensorData) element, searchCriteria, repositoryDefinition); } else if (InvocationSequenceData.class.equals(element.getClass())) { return invocationSearchFinder.isSearchCompatible((InvocationSequenceData) element, searchCriteria, repositoryDefinition); } else if (JmxSensorValueData.class.equals(element.getClass())) { return jmxSearchFinder.isSearchCompatible((JmxSensorValueData) element, searchCriteria, repositoryDefinition); } else if (Span.class.isAssignableFrom(element.getClass())) { return spanSearchFinder.isSearchCompatible((Span) element, searchCriteria, repositoryDefinition); } return false; } private  SearchFactory(); static boolean isSearchCompatible(Object element, SearchCriteria searchCriteria, RepositoryDefinition repositoryDefinition); }
SearchFactory { public static boolean isSearchCompatible(Object element, SearchCriteria searchCriteria, RepositoryDefinition repositoryDefinition) { if (null == element) { return false; } if (TimerData.class.equals(element.getClass()) || AggregatedTimerData.class.equals(element.getClass())) { return timerSearchFinder.isSearchCompatible((TimerData) element, searchCriteria, repositoryDefinition); } else if (SqlStatementData.class.equals(element.getClass()) || AggregatedSqlStatementData.class.equals(element.getClass())) { return sqlSearchFinder.isSearchCompatible((SqlStatementData) element, searchCriteria, repositoryDefinition); } else if (HttpTimerData.class.equals(element.getClass()) || AggregatedHttpTimerData.class.equals(element.getClass())) { return httpSearchFinder.isSearchCompatible((HttpTimerData) element, searchCriteria, repositoryDefinition); } else if (ExceptionSensorData.class.equals(element.getClass()) || AggregatedExceptionSensorData.class.equals(element.getClass())) { return exceptionSearchFinder.isSearchCompatible((ExceptionSensorData) element, searchCriteria, repositoryDefinition); } else if (InvocationSequenceData.class.equals(element.getClass())) { return invocationSearchFinder.isSearchCompatible((InvocationSequenceData) element, searchCriteria, repositoryDefinition); } else if (JmxSensorValueData.class.equals(element.getClass())) { return jmxSearchFinder.isSearchCompatible((JmxSensorValueData) element, searchCriteria, repositoryDefinition); } else if (Span.class.isAssignableFrom(element.getClass())) { return spanSearchFinder.isSearchCompatible((Span) element, searchCriteria, repositoryDefinition); } return false; } private  SearchFactory(); static boolean isSearchCompatible(Object element, SearchCriteria searchCriteria, RepositoryDefinition repositoryDefinition);  }