Search in sources :

Example 1 with SearchMultiSelectField

use of com.netsuite.webservices.test.platform.core.SearchMultiSelectField in project components by Talend.

the class SearchQueryTest method testSearchMultiSelectField.

@Test
public void testSearchMultiSelectField() throws Exception {
    clientService.getMetaDataSource().setCustomMetaDataSource(new TestCustomMetaDataSource());
    SearchQuery s1 = clientService.newSearch();
    s1.target("custom_record_type_1");
    s1.condition(new SearchCondition("Owner", "List.anyOf", Arrays.asList("123456789")));
    SearchRecord sr1 = (SearchRecord) s1.toNativeQuery();
    assertNotNull(sr1);
    Assert.assertEquals(CustomRecordSearch.class, sr1.getClass());
    CustomRecordSearch search = (CustomRecordSearch) sr1;
    assertNotNull(search.getBasic());
    CustomRecordSearchBasic searchBasic = search.getBasic();
    assertNotNull(searchBasic.getOwner());
    SearchMultiSelectField sf1 = searchBasic.getOwner();
    assertNotNull(sf1.getSearchValue());
    Assert.assertEquals(1, sf1.getSearchValue().size());
    Assert.assertEquals("123456789", sf1.getSearchValue().get(0).getInternalId());
}
Also used : SearchQuery(org.talend.components.netsuite.client.search.SearchQuery) SearchRecord(com.netsuite.webservices.test.platform.core.SearchRecord) SearchCondition(org.talend.components.netsuite.client.search.SearchCondition) CustomRecordSearch(com.netsuite.webservices.test.setup.customization.CustomRecordSearch) CustomRecordSearchBasic(com.netsuite.webservices.test.platform.common.CustomRecordSearchBasic) SearchMultiSelectField(com.netsuite.webservices.test.platform.core.SearchMultiSelectField) Test(org.junit.Test)

Example 2 with SearchMultiSelectField

use of com.netsuite.webservices.test.platform.core.SearchMultiSelectField in project components by Talend.

the class SearchFieldAdaptersTest method testAdapterForMultiSelectSearchField.

@Test
public void testAdapterForMultiSelectSearchField() {
    SearchMultiSelectFieldAdapter adapter1 = new SearchMultiSelectFieldAdapter(basicMetaData, SearchFieldType.MULTI_SELECT, SearchMultiSelectField.class);
    SearchMultiSelectField field1 = (SearchMultiSelectField) adapter1.populate(null, "List.anyOf", Arrays.asList("abc"));
    assertNotNull(field1);
    assertEquals(SearchMultiSelectFieldOperator.ANY_OF, field1.getOperator());
    assertNotNull(field1.getSearchValue());
    assertEquals(1, field1.getSearchValue().size());
    assertEquals("abc", field1.getSearchValue().get(0).getInternalId());
    field1 = (SearchMultiSelectField) adapter1.populate(null, "List.noneOf", Collections.emptyList());
    assertEquals(SearchMultiSelectFieldOperator.NONE_OF, field1.getOperator());
    assertNotNull(field1.getSearchValue());
    assertEquals(0, field1.getSearchValue().size());
    SearchMultiSelectFieldAdapter adapter2 = new SearchMultiSelectFieldAdapter(basicMetaData, SearchFieldType.CUSTOM_MULTI_SELECT, SearchMultiSelectCustomField.class);
    SearchMultiSelectCustomField field2 = (SearchMultiSelectCustomField) adapter2.populate(null, "List.anyOf", Arrays.asList("qwerty"));
    assertNotNull(field2);
    assertEquals(SearchMultiSelectFieldOperator.ANY_OF, field2.getOperator());
    assertEquals(1, field2.getSearchValue().size());
    assertEquals("qwerty", field2.getSearchValue().get(0).getInternalId());
}
Also used : SearchMultiSelectCustomField(com.netsuite.webservices.test.platform.core.SearchMultiSelectCustomField) SearchMultiSelectField(com.netsuite.webservices.test.platform.core.SearchMultiSelectField) Test(org.junit.Test)

Aggregations

SearchMultiSelectField (com.netsuite.webservices.test.platform.core.SearchMultiSelectField)2 Test (org.junit.Test)2 CustomRecordSearchBasic (com.netsuite.webservices.test.platform.common.CustomRecordSearchBasic)1 SearchMultiSelectCustomField (com.netsuite.webservices.test.platform.core.SearchMultiSelectCustomField)1 SearchRecord (com.netsuite.webservices.test.platform.core.SearchRecord)1 CustomRecordSearch (com.netsuite.webservices.test.setup.customization.CustomRecordSearch)1 SearchCondition (org.talend.components.netsuite.client.search.SearchCondition)1 SearchQuery (org.talend.components.netsuite.client.search.SearchQuery)1