@Test public void httpTimerDataSearch() { HttpTimerData httpData = new HttpTimerData(); httpData.setMethodIdent(1L); SearchCriteria searchCriteria = new SearchCriteria("Blah"); SearchCriteria wrong = new SearchCriteria("halB"); httpData.getHttpInfo().setInspectItTaggingHeaderValue("blaha"); 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))); httpData.getHttpInfo().setInspectItTaggingHeaderValue(""); httpData.getHttpInfo().setUri("ablah"); 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))); httpData.getHttpInfo().setUri(""); httpData.getHttpInfo().setRequestMethod("ablaha"); 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))); Map<String, String> map = new HashMap<>(); map.put("ablaha", "value"); httpData.getHttpInfo().setRequestMethod(""); httpData.setAttributes(map); 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))); httpData.setAttributes(Collections.<String, String> emptyMap()); httpData.setSessionAttributes(map); 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))); httpData.setSessionAttributes(Collections.<String, String> emptyMap()); map.clear(); map.put("key", "ablaha"); httpData.setHeaders(map); 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))); httpData.setHeaders(Collections.<String, String> emptyMap()); Map<String, String[]> map1 = new HashMap<>(); map1.put("key", new String[] { "blah", "anotherValue" }); httpData.setParameters(map1); 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))); }
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);  }