Commit 09845999 authored by Maxym Borodenko's avatar Maxym Borodenko

Filter: Accession number

parent 47bc3058
......@@ -3,6 +3,7 @@ package org.genesys2.brapi.service.impl;
import java.util.UUID;
import java.util.stream.Collectors;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
import org.genesys2.brapi.model.Germplasm;
import org.genesys2.brapi.service.BrAPIService;
......@@ -101,7 +102,7 @@ public class BrAPIServiceImpl implements BrAPIService {
}
if (StringUtils.isNotBlank(germplasmName)) {
accessionFilter.acceNumb().eq = germplasmName;
accessionFilter.acceNumb().eq(germplasmName);
}
......
......@@ -709,17 +709,16 @@ public class DatasetServiceTest extends AbstractDatasetServiceTest {
assertThat(datasetService.listDatasets(filter, PageRequest.of(0, 3)).getContent(), hasSize(0));
filter.accessionRefs.genus.clear();
filter.accessionRefs.acceNumb = new StringFilter();
filter.accessionRefs.acceNumb = new StringFilter().eq("A8"); // only in dataset1
filter.accessionRefs.acceNumb.eq = "A8"; // only in dataset1
assertThat(datasetService.listDatasets(filter, PageRequest.of(0, 3)).getContent(), hasSize(1));
assertThat(datasetService.listDatasets(filter, PageRequest.of(0, 3)).getContent().stream().map(d -> d.getUuid()).collect(Collectors.toSet()), contains(dataset1
.getUuid()));
filter.accessionRefs.acceNumb.eq = "A1"; // in both
filter.accessionRefs.acceNumb.eq = Sets.newHashSet("A1"); // in both
assertThat(datasetService.listDatasets(filter, PageRequest.of(0, 3)).getContent(), hasSize(2));
filter.accessionRefs.acceNumb.eq = "A8"; // only in dataset1
filter.accessionRefs.acceNumb.eq = Sets.newHashSet("A8"); // only in dataset1
filter.accessionRefs.genus("Musa");
assertThat(datasetService.listDatasets(filter, PageRequest.of(0, 3)).getContent(), hasSize(1));
assertThat(datasetService.listDatasets(filter, PageRequest.of(0, 3)).getContent().stream().map(d -> d.getUuid()).collect(Collectors.toSet()), contains(dataset1
......
......@@ -69,11 +69,11 @@ public class ShortFilterServiceTest extends CatalogServiceTest {
public void testCreate() throws IOException {
final DescriptorListFilter filter = new DescriptorListFilter();
filter.title = new StringFilter();
filter.title.eq = "TEST";
filter.title.eq("TEST");
filter.description = new StringFilter();
final String[] cropValues = { "yam", "banana", "wheat", "rice", "barley", "apple" };
filter.description.eq = "THIS IS description";
filter.description.contains = "contains description";
filter.description.eq("THIS IS description");
filter.description.contains("contains description");
filter.crop = Arrays.stream(cropValues).collect(Collectors.toSet());
String shortName = shortFilterService.getCode(filter);
......
......@@ -58,7 +58,7 @@ public abstract class AbstractAccessionControllerTest extends AbstractApiTest {
protected static final int STORAGE_11 = 11;
protected static final String ACCENUMB_1 = "A-0001";
protected static final String ACCENUMB_2 = "A-0002";
protected static final String ACCENUMB_2 = "B-0002";
protected static final String GENUS_1 = "Hordeum";
protected static final String GENUS_2 = "Musa";
......
......@@ -25,6 +25,7 @@ import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
......@@ -280,6 +281,120 @@ public class AccessionControllerTest extends AbstractAccessionControllerTest {
/*@formatter:on*/
}
@Test
public void filterByAccessionNumberTest1() throws Exception {
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_1, GENUS_1, null));
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_2, GENUS_2, null));
// ensure we have 2 accessions in DB
assertEquals(2, accessionRepository.count());
/*@formatter:off*/
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"eq\":\"%s\"}}", ACCENUMB_1)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(1)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(ACCENUMB_1)))
;
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"eq\":[\"%1s\",\"%2s\"]}}", ACCENUMB_1, ACCENUMB_2)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(2)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
.andExpect(jsonPath("$.content[1].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
;
/*@formatter:on*/
}
@Test
public void filterByAccessionNumberTest2() throws Exception {
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_1, GENUS_1, null));
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_2, GENUS_2, null));
// ensure we have 2 accessions in DB
assertEquals(2, accessionRepository.count());
/*@formatter:off*/
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"sw\":\"%s\"}}", ACCENUMB_1.substring(0, 3))))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(1)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(ACCENUMB_1)))
;
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"sw\":[\"%1s\",\"%2s\"]}}", ACCENUMB_1, ACCENUMB_2.substring(0, 3))))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(2)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
.andExpect(jsonPath("$.content[1].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
;
/*@formatter:on*/
}
@Test
public void filterByAccessionNumberTest3() throws Exception {
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_1, GENUS_1, null));
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_2, GENUS_2, null));
// ensure we have 2 accessions in DB
assertEquals(2, accessionRepository.count());
/*@formatter:off*/
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"contains\":\"%s\"}}", ACCENUMB_1)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(1)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(ACCENUMB_1)))
;
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"contains\":[\"%1s\",\"%2s\"]}}", ACCENUMB_1, ACCENUMB_2)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(2)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
.andExpect(jsonPath("$.content[1].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
;
/*@formatter:on*/
}
@Test
public void taxonomyFilterTest() throws Exception {
ObjectNode accessionJson = setUpAccession();
......
......@@ -532,9 +532,7 @@ public class DatasetControllerTest extends AbstractDatasetControllerTest {
assertThat(datasetRepository.count(), is(2L));
final DatasetFilter datasetFilter = new DatasetFilter();
final StringFilter datasetTitle = new StringFilter();
datasetTitle.contains = "two";
datasetFilter.title = datasetTitle;
datasetFilter.title = new StringFilter().contains("two");
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.shortName = new HashSet<>();
partnerFilter.shortName.add("PartnerShortNameTwo");
......
......@@ -125,7 +125,7 @@ public class DescriptorControllerTest extends AbstractApiTest {
final DescriptorFilter descriptorFilter = new DescriptorFilter();
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.name = StringFilter.eq(PARTNER_NAME);
partnerFilter.name = new StringFilter().eq(PARTNER_NAME);
descriptorFilter.owner = partnerFilter;
/*@formatter:off*/
......@@ -152,8 +152,7 @@ public class DescriptorControllerTest extends AbstractApiTest {
assertThat(descriptorRepository.count(), is(1L));
final DescriptorFilter filter = new DescriptorFilter();
filter.title = new StringFilter();
filter.title.eq = descriptor.getTitle();
filter.title = new StringFilter().eq(descriptor.getTitle());
// filter.owner = new PartnerFilter();
// final StringFilter partnerName = new StringFilter();
// partnerName.eq = partner.getName();
......
......@@ -261,10 +261,8 @@ public class DescriptorListControllerTest extends AbstractApiTest {
assertThat(descriptorListRepository.count(), is(1L));
final DescriptorListFilter filter = new DescriptorListFilter();
filter.description = new StringFilter();
filter.description.eq = "Test description";
filter.title = new StringFilter();
filter.title.contains = "title";
filter.description = new StringFilter().eq("Test description");
filter.title = new StringFilter().contains("title");
final String filterCode = shortFilterService.getCode(filter);
......
......@@ -69,7 +69,7 @@ public class PartnerControllerTest extends AbstractApiTest {
@Test
public void listPartnersTest() throws Exception {
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.name = StringFilter.eq("Partner Two");
partnerFilter.name = new StringFilter().eq("Partner Two");
Partner partner = partnerRepository.save(setPartner("Partner one", true, "Partner one", UUID.randomUUID()));
partner = partnerRepository.save(setPartner("Partner Two", true, "Partner Two", UUID.randomUUID()));
......@@ -217,7 +217,7 @@ public class PartnerControllerTest extends AbstractApiTest {
@Test
public void listPartnersByFilterCodeTest() throws Exception {
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.name = StringFilter.eq("Partner one");
partnerFilter.name = new StringFilter().eq("Partner one");
final Partner partner = partnerRepository.save(setPartner("Partner one", true, "Partner one", UUID.randomUUID()));
partnerRepository.save(setPartner("Partner Two", true, "Partner Two", UUID.randomUUID()));
......
......@@ -87,7 +87,7 @@ public class UserManagementControllerTest extends AbstractApiTest {
@WithMockUser(roles = "ADMINISTRATOR")
public void listSubsetsTest() throws Exception {
final UserFilter userFilter = new UserFilter();
userFilter.email = StringFilter.eq(EMAIL);
userFilter.email = new StringFilter().eq(EMAIL);
/*@formatter:off*/
mockMvc.perform(post(UserManagementController.CONTROLLER_URL.concat("/list"))
......
......@@ -27,7 +27,9 @@ import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.oneOf;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
......@@ -157,6 +159,120 @@ public class AccessionControllerTest extends AbstractAccessionControllerTest {
assertThat(accessionRepository.count(), is(1L));
}
@Test
public void filterByAccessionNumberTest1() throws Exception {
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_1, GENUS_1, null));
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_2, GENUS_2, null));
// ensure we have 2 accessions in DB
assertEquals(2, accessionRepository.count());
/*@formatter:off*/
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"eq\":\"%s\"}}", ACCENUMB_1)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(1)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(ACCENUMB_1)))
;
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"eq\":[\"%1s\",\"%2s\"]}}", ACCENUMB_1, ACCENUMB_2)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(2)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
.andExpect(jsonPath("$.content[1].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
;
/*@formatter:on*/
}
@Test
public void filterByAccessionNumberTest2() throws Exception {
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_1, GENUS_1, null));
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_2, GENUS_2, null));
// ensure we have 2 accessions in DB
assertEquals(2, accessionRepository.count());
/*@formatter:off*/
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"sw\":\"%s\"}}", ACCENUMB_1.substring(0, 3))))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(1)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(ACCENUMB_1)))
;
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"sw\":[\"%1s\",\"%2s\"]}}", ACCENUMB_1, ACCENUMB_2.substring(0, 3))))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(2)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
.andExpect(jsonPath("$.content[1].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
;
/*@formatter:on*/
}
@Test
public void filterByAccessionNumberTest3() throws Exception {
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_1, GENUS_1, null));
accessionUploader.upsertAccessions(institute, upsertAccessions(institute.getCode(), ACCENUMB_2, GENUS_2, null));
// ensure we have 2 accessions in DB
assertEquals(2, accessionRepository.count());
/*@formatter:off*/
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"contains\":\"%s\"}}", ACCENUMB_1)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(1)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(ACCENUMB_1)))
;
mockMvc
.perform(post(AccessionController.CONTROLLER_URL + "/list")
.contentType(MediaType.APPLICATION_JSON)
.content(String.format("{\"accessionNumber\":{\"contains\":[\"%1s\",\"%2s\"]}}", ACCENUMB_1, ACCENUMB_2)))
// .andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", not(nullValue())))
.andExpect(jsonPath("$.totalElements", is(2)))
.andExpect(jsonPath("$.content").isArray())
.andExpect(jsonPath("$.content[0].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
.andExpect(jsonPath("$.content[1].accessionNumber", is(oneOf(ACCENUMB_1, ACCENUMB_2))))
;
/*@formatter:on*/
}
@Test
public void getAccessionDetailsWithLazyLoadedFieldsTest() throws Exception {
// add a new crop to DB
......
......@@ -332,9 +332,7 @@ public class DatasetControllerTest extends AbstractDatasetControllerTest {
assertThat(datasetRepository.count(), is(2L));
final DatasetFilter datasetFilter = new DatasetFilter();
final StringFilter datasetTitle = new StringFilter();
datasetTitle.contains = "two";
datasetFilter.title = datasetTitle;
datasetFilter.title = new StringFilter().contains("two");
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.shortName = new HashSet<>();
partnerFilter.shortName.add("PartnerShortNameTwo");
......
......@@ -126,7 +126,7 @@ public class DescriptorControllerTest extends AbstractApiTest {
final DescriptorFilter descriptorFilter = new DescriptorFilter();
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.name = StringFilter.eq(PARTNER_NAME);
partnerFilter.name = new StringFilter().eq(PARTNER_NAME);
descriptorFilter.owner = partnerFilter;
/*@formatter:off*/
......@@ -153,8 +153,7 @@ public class DescriptorControllerTest extends AbstractApiTest {
assertThat(descriptorRepository.count(), is(1L));
final DescriptorFilter filter = new DescriptorFilter();
filter.title = new StringFilter();
filter.title.eq = descriptor.getTitle();
filter.title = new StringFilter().eq(descriptor.getTitle());
final String filterCode = shortFilterService.getCode(filter);
......
......@@ -269,10 +269,8 @@ public class DescriptorListControllerTest extends AbstractApiTest {
assertThat(descriptorListRepository.count(), is(1L));
final DescriptorListFilter filter = new DescriptorListFilter();
filter.description = new StringFilter();
filter.description.eq = "Test description";
filter.title = new StringFilter();
filter.title.contains = "title";
filter.description = new StringFilter().eq("Test description");
filter.title = new StringFilter().contains("title");
final String filterCode = shortFilterService.getCode(filter);
......
......@@ -76,7 +76,7 @@ public class PartnerControllerTest extends AbstractApiTest {
@Test
public void listPartnersTest() throws Exception {
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.name = StringFilter.eq("Partner Two");
partnerFilter.name = new StringFilter().eq("Partner Two");
Partner partner = partnerRepository.save(setPartner("Partner Two", true, "Partner Two", UUID.randomUUID()));
/*@formatter:off*/
......@@ -222,7 +222,7 @@ public class PartnerControllerTest extends AbstractApiTest {
@Test
public void listPartnersByFilterCodeTest() throws Exception {
final PartnerFilter partnerFilter = new PartnerFilter();
partnerFilter.name = StringFilter.eq("Partner one");
partnerFilter.name = new StringFilter().eq("Partner one");
final Partner partner = partnerRepository.save(setPartner("Partner one", true, "Partner one", UUID.randomUUID()));
partnerRepository.save(setPartner("Partner Two", true, "Partner Two", UUID.randomUUID()));
......
......@@ -110,7 +110,7 @@ public class UserManagementControllerTest extends AbstractApiTest {
assertThat(userRepository.count(), is(1L));
final UserFilter userFilter = new UserFilter();
userFilter.email = StringFilter.eq(user.getEmail());
userFilter.email = new StringFilter().eq(user.getEmail());
/*@formatter:off*/
mockMvc
......
......@@ -189,7 +189,7 @@ public class ElasticQueryBuilderTest extends AbstractElasticServiceTest {
public void testLike() throws SearchException, JsonProcessingException {
AccessionFilter af = new AccessionFilter();
af.accessionNumber = new StringFilter();
af.accessionNumber.contains = "ACCE";
af.accessionNumber.contains("ACCE");
List<Accession> search = elasticsearchService.find(Accession.class, af);
assertThat(search.size(), is(2));
......@@ -321,7 +321,7 @@ public class ElasticQueryBuilderTest extends AbstractElasticServiceTest {
public void testReindex() throws SearchException, JsonProcessingException {
AccessionFilter af = new AccessionFilter();
af.accessionNumber = new StringFilter();
af.accessionNumber.contains = "ACCE";
af.accessionNumber.contains("ACCE");
List<Accession> search = elasticsearchService.find(Accession.class, af);
assertThat(search.size(), is(2));
......
......@@ -45,8 +45,8 @@ public class EsQueryTest {
AccessionFilter af = new AccessionFilter();
af.active = true;
af.accessionNumber = new StringFilter();
af.accessionNumber.eq = "IRGC 1";
af.accessionNumber.sw = "FOO";
af.accessionNumber.eq("IRGC 1");
af.accessionNumber.sw("FOO");
af.geo = new AccessionGeoFilter();
af.geo.latitude = new NumberFilter<>();
af.geo.latitude.ge = 10d;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment