@Test public void invocationDataSearch() { InvocationSequenceData invocationData = new InvocationSequenceData(); invocationData.setMethodIdent(1L); SearchCriteria searchCriteria = new SearchCriteria("Blah"); SearchCriteria wrong = new SearchCriteria("halB"); HttpTimerData httpData = new HttpTimerData(); httpData.setMethodIdent(1L); httpData.getHttpInfo().setInspectItTaggingHeaderValue("blaha"); invocationData.setTimerData(httpData); searchCriteria.setCaseSensitive(false); assertThat(SearchFactory.isSearchCompatible(httpData, searchCriteria, repositoryDefinition), is(equalTo(true))); searchCriteria.setCaseSensitive(true); assertThat(SearchFactory.isSearchCompatible(httpData, searchCriteria, repositoryDefinition), is(equalTo(false))); assertThat(SearchFactory.isSearchCompatible(httpData, wrong, repositoryDefinition), is(equalTo(false))); invocationData.setTimerData(null); SqlStatementData sqlData = new SqlStatementData(); sqlData.setMethodIdent(1L); sqlData.setSql("Select blah from table where condition"); invocationData.setSqlStatementData(sqlData); searchCriteria.setCaseSensitive(false); assertThat(SearchFactory.isSearchCompatible(invocationData, searchCriteria, repositoryDefinition), is(equalTo(true))); searchCriteria.setCaseSensitive(true); assertThat(SearchFactory.isSearchCompatible(invocationData, searchCriteria, repositoryDefinition), is(equalTo(false))); assertThat(SearchFactory.isSearchCompatible(invocationData, wrong, repositoryDefinition), is(equalTo(false))); invocationData.setSqlStatementData(null); ExceptionSensorData exceptionData = new ExceptionSensorData(); exceptionData.setMethodIdent(1L); exceptionData.setCause("blah"); List<ExceptionSensorData> exceptionList = new ArrayList<>(); exceptionList.add(exceptionData); invocationData.setExceptionSensorDataObjects(exceptionList); searchCriteria.setCaseSensitive(false); assertThat(SearchFactory.isSearchCompatible(invocationData, searchCriteria, repositoryDefinition), is(equalTo(true))); searchCriteria.setCaseSensitive(true); assertThat(SearchFactory.isSearchCompatible(invocationData, searchCriteria, repositoryDefinition), is(equalTo(false))); assertThat(SearchFactory.isSearchCompatible(invocationData, 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);  }