@Test public void testNegativeFreetextFilter() { ResourceListQueryImpl query = makeQuery(new StringListFilter("doesnt exist")); assertFalse(service.isCompliant(query)); }
public boolean isCompliant(ResourceListQuery query) { if (query == null) { return true; } List<ResourceListFilter<?>> filters = query.getFilters(); for (ResourceListFilter<?> resourceListFilter : filters) { String filterName = resourceListFilter.getName(); Object value = resourceListFilter.getValue().get(); if (!(value instanceof String)) { return false; } String filterValue = (String) value; if (filterName.equals(ResourceListFilter.FREETEXT)) { return complies(NAME, filterValue) || complies(HOST, filterValue); } if (!complies(filterName, filterValue)) { return false; } } return true; }
Service implements JSONAware { public boolean isCompliant(ResourceListQuery query) { if (query == null) { return true; } List<ResourceListFilter<?>> filters = query.getFilters(); for (ResourceListFilter<?> resourceListFilter : filters) { String filterName = resourceListFilter.getName(); Object value = resourceListFilter.getValue().get(); if (!(value instanceof String)) { return false; } String filterValue = (String) value; if (filterName.equals(ResourceListFilter.FREETEXT)) { return complies(NAME, filterValue) || complies(HOST, filterValue); } if (!complies(filterName, filterValue)) { return false; } } return true; } }
Service implements JSONAware { public boolean isCompliant(ResourceListQuery query) { if (query == null) { return true; } List<ResourceListFilter<?>> filters = query.getFilters(); for (ResourceListFilter<?> resourceListFilter : filters) { String filterName = resourceListFilter.getName(); Object value = resourceListFilter.getValue().get(); if (!(value instanceof String)) { return false; } String filterValue = (String) value; if (filterName.equals(ResourceListFilter.FREETEXT)) { return complies(NAME, filterValue) || complies(HOST, filterValue); } if (!complies(filterName, filterValue)) { return false; } } return true; } Service(ServiceStatistics stats); }
Service implements JSONAware { public boolean isCompliant(ResourceListQuery query) { if (query == null) { return true; } List<ResourceListFilter<?>> filters = query.getFilters(); for (ResourceListFilter<?> resourceListFilter : filters) { String filterName = resourceListFilter.getName(); Object value = resourceListFilter.getValue().get(); if (!(value instanceof String)) { return false; } String filterValue = (String) value; if (filterName.equals(ResourceListFilter.FREETEXT)) { return complies(NAME, filterValue) || complies(HOST, filterValue); } if (!complies(filterName, filterValue)) { return false; } } return true; } Service(ServiceStatistics stats); void setHost(String host); String getName(); void setName(String name); String getStatus(); void setStatus(ServiceState status); Integer getCompleted(); void setCompleted(Integer completed); Integer getRunning(); void setRunning(Integer running); Integer getQueued(); void setQueued(Integer queued); void setMeanQueueTime(long meanQueueTime); long getMeanQueueTime(); void setMeanRunTime(long meanRunTime); long getMeanRunTime(); String getHost(); @Override String toJSONString(); boolean isCompliant(ResourceListQuery query); }
Service implements JSONAware { public boolean isCompliant(ResourceListQuery query) { if (query == null) { return true; } List<ResourceListFilter<?>> filters = query.getFilters(); for (ResourceListFilter<?> resourceListFilter : filters) { String filterName = resourceListFilter.getName(); Object value = resourceListFilter.getValue().get(); if (!(value instanceof String)) { return false; } String filterValue = (String) value; if (filterName.equals(ResourceListFilter.FREETEXT)) { return complies(NAME, filterValue) || complies(HOST, filterValue); } if (!complies(filterName, filterValue)) { return false; } } return true; } Service(ServiceStatistics stats); void setHost(String host); String getName(); void setName(String name); String getStatus(); void setStatus(ServiceState status); Integer getCompleted(); void setCompleted(Integer completed); Integer getRunning(); void setRunning(Integer running); Integer getQueued(); void setQueued(Integer queued); void setMeanQueueTime(long meanQueueTime); long getMeanQueueTime(); void setMeanRunTime(long meanRunTime); long getMeanRunTime(); String getHost(); @Override String toJSONString(); boolean isCompliant(ResourceListQuery query);  }