use of org.talend.components.netsuite.client.search.SearchCondition 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());
}
use of org.talend.components.netsuite.client.search.SearchCondition in project components by Talend.
the class NetSuiteClientServiceIT method testConnectAndLogin.
@Test
public void testConnectAndLogin() throws Exception {
NetSuiteClientService<?> connection = webServiceTestFixture.getClientService();
connection.login();
SearchResultSet<Record> rs = connection.newSearch().target("Account").condition(new SearchCondition("Type", "List.anyOf", Arrays.asList("Bank"))).search();
int count = 10;
int retrievedCount = 0;
while (rs.next() && count-- > 0) {
Record record = rs.get();
assertEquals(AccountType.BANK, getProperty(record, "acctType"));
retrievedCount++;
}
assertTrue(retrievedCount > 1);
}
use of org.talend.components.netsuite.client.search.SearchCondition in project components by Talend.
the class NetSuiteClientServiceIT method testConnectAndLogin.
@Test
public void testConnectAndLogin() throws Exception {
NetSuiteClientService<?> connection = webServiceTestFixture.getClientService();
connection.login();
SearchResultSet<Record> rs = connection.newSearch().target("Account").condition(new SearchCondition("Type", "List.anyOf", Arrays.asList("Bank"))).search();
int count = 10;
int retrievedCount = 0;
while (rs.next() && count-- > 0) {
Record record = rs.get();
assertEquals(AccountType.BANK, getProperty(record, "acctType"));
retrievedCount++;
}
assertTrue(retrievedCount > 1);
}
Aggregations