Search in sources :

Example 1 with AddressSearchBasic

use of com.netsuite.webservices.test.platform.common.AddressSearchBasic in project components by Talend.

the class SearchQueryTest method testSearchForSpecialRecordTypes.

@Test
public void testSearchForSpecialRecordTypes() throws Exception {
    SearchQuery s1 = clientService.newSearch();
    s1.target("Address");
    s1.condition(new SearchCondition("Country", "List.anyOf", Arrays.asList("Ukraine")));
    s1.condition(new SearchCondition("CustomStringField1", "String.contains", Arrays.asList("abc")));
    SearchRecord sr1 = (SearchRecord) s1.toNativeQuery();
    assertNotNull(sr1);
    Assert.assertEquals(AddressSearchBasic.class, sr1.getClass());
    AddressSearchBasic search = (AddressSearchBasic) sr1;
    assertNotNull(search.getCountry());
    SearchEnumMultiSelectField field1 = search.getCountry();
    assertNotNull(field1);
    Assert.assertEquals(SearchEnumMultiSelectFieldOperator.ANY_OF, field1.getOperator());
    assertNotNull(field1.getSearchValue());
    Assert.assertEquals(1, field1.getSearchValue().size());
    Assert.assertEquals(Arrays.asList("Ukraine"), field1.getSearchValue());
    SearchCustomFieldList customFieldList = search.getCustomFieldList();
    assertNotNull(customFieldList);
    assertNotNull(customFieldList.getCustomField());
    Assert.assertEquals(1, customFieldList.getCustomField().size());
    SearchStringCustomField customField1 = (SearchStringCustomField) customFieldList.getCustomField().get(0);
    assertNotNull(customField1.getOperator());
    Assert.assertEquals(SearchStringFieldOperator.CONTAINS, customField1.getOperator());
    assertNotNull(customField1.getSearchValue());
    Assert.assertEquals("abc", customField1.getSearchValue());
}
Also used : SearchQuery(org.talend.components.netsuite.client.search.SearchQuery) SearchRecord(com.netsuite.webservices.test.platform.core.SearchRecord) AddressSearchBasic(com.netsuite.webservices.test.platform.common.AddressSearchBasic) SearchCondition(org.talend.components.netsuite.client.search.SearchCondition) SearchStringCustomField(com.netsuite.webservices.test.platform.core.SearchStringCustomField) SearchCustomFieldList(com.netsuite.webservices.test.platform.core.SearchCustomFieldList) SearchEnumMultiSelectField(com.netsuite.webservices.test.platform.core.SearchEnumMultiSelectField) Test(org.junit.Test)

Aggregations

AddressSearchBasic (com.netsuite.webservices.test.platform.common.AddressSearchBasic)1 SearchCustomFieldList (com.netsuite.webservices.test.platform.core.SearchCustomFieldList)1 SearchEnumMultiSelectField (com.netsuite.webservices.test.platform.core.SearchEnumMultiSelectField)1 SearchRecord (com.netsuite.webservices.test.platform.core.SearchRecord)1 SearchStringCustomField (com.netsuite.webservices.test.platform.core.SearchStringCustomField)1 Test (org.junit.Test)1 SearchCondition (org.talend.components.netsuite.client.search.SearchCondition)1 SearchQuery (org.talend.components.netsuite.client.search.SearchQuery)1