Search in sources :

Example 6 with SearchCondition

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());
}
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)

Example 7 with SearchCondition

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);
}
Also used : SearchCondition(org.talend.components.netsuite.client.search.SearchCondition) Record(com.netsuite.webservices.v2016_2.platform.core.Record) Test(org.junit.Test)

Example 8 with SearchCondition

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);
}
Also used : SearchCondition(org.talend.components.netsuite.client.search.SearchCondition) Record(com.netsuite.webservices.v2014_2.platform.core.Record) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 SearchCondition (org.talend.components.netsuite.client.search.SearchCondition)8 SearchRecord (com.netsuite.webservices.test.platform.core.SearchRecord)6 SearchQuery (org.talend.components.netsuite.client.search.SearchQuery)6 SearchCustomFieldList (com.netsuite.webservices.test.platform.core.SearchCustomFieldList)4 SearchEnumMultiSelectField (com.netsuite.webservices.test.platform.core.SearchEnumMultiSelectField)3 AccountSearch (com.netsuite.webservices.test.lists.accounting.AccountSearch)2 AccountSearchBasic (com.netsuite.webservices.test.platform.common.AccountSearchBasic)2 TransactionSearchBasic (com.netsuite.webservices.test.platform.common.TransactionSearchBasic)2 SearchDateCustomField (com.netsuite.webservices.test.platform.core.SearchDateCustomField)2 SearchDateField (com.netsuite.webservices.test.platform.core.SearchDateField)2 SearchStringCustomField (com.netsuite.webservices.test.platform.core.SearchStringCustomField)2 SearchStringField (com.netsuite.webservices.test.platform.core.SearchStringField)2 TransactionSearch (com.netsuite.webservices.test.transactions.sales.TransactionSearch)2 AddressSearchBasic (com.netsuite.webservices.test.platform.common.AddressSearchBasic)1 CustomRecordSearchBasic (com.netsuite.webservices.test.platform.common.CustomRecordSearchBasic)1 SearchBooleanCustomField (com.netsuite.webservices.test.platform.core.SearchBooleanCustomField)1 SearchBooleanField (com.netsuite.webservices.test.platform.core.SearchBooleanField)1 SearchDoubleField (com.netsuite.webservices.test.platform.core.SearchDoubleField)1 SearchLongCustomField (com.netsuite.webservices.test.platform.core.SearchLongCustomField)1