use of com.netsuite.webservices.test.transactions.sales.Opportunity in project components by Talend.
the class NetSuiteOutputTransducerTest method testCustomFields.
@Test
public void testCustomFields() throws Exception {
TestCustomMetaDataSource customMetaDataSource = new TestCustomMetaDataSource(clientService, "Opportunity");
clientService.getMetaDataSource().setCustomMetaDataSource(customMetaDataSource);
NetSuiteRuntime netSuiteRuntime = new TestNetSuiteRuntimeImpl(webServiceMockTestFixture.getClientFactory());
NetSuiteDatasetRuntime dataSetRuntime = netSuiteRuntime.getDatasetRuntime(mockTestFixture.getConnectionProperties());
mockGetRequestResults(null);
TypeDesc basicTypeDesc = clientService.getBasicMetaData().getTypeInfo("Opportunity");
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("Opportunity");
final List<Opportunity> recordList = makeNsObjects(new NsObjectComposer<Opportunity>(clientService.getMetaDataSource(), typeDesc), 10);
mockSearchRequestResults(recordList, 100);
Schema schema = dataSetRuntime.getSchema(typeDesc.getTypeName());
NsObjectOutputTransducer transducer = new NsObjectOutputTransducer(webServiceMockTestFixture.getClientService(), typeDesc.getTypeName());
List<IndexedRecord> indexedRecordList = makeIndexedRecords(clientService, schema, new NsObjectComposer<Opportunity>(clientService.getMetaDataSource(), typeDesc), 10);
for (IndexedRecord indexedRecord : indexedRecordList) {
Opportunity record = (Opportunity) transducer.write(indexedRecord);
assertNsObject(basicTypeDesc, record);
}
}
use of com.netsuite.webservices.test.transactions.sales.Opportunity in project components by Talend.
the class NetSuiteOutputTransducerTest method testBasic.
@Test
public void testBasic() throws Exception {
NetSuiteRuntime netSuiteRuntime = new TestNetSuiteRuntimeImpl(webServiceMockTestFixture.getClientFactory());
NetSuiteDatasetRuntime dataSetRuntime = netSuiteRuntime.getDatasetRuntime(mockTestFixture.getConnectionProperties());
mockGetRequestResults(null);
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("Opportunity");
Schema schema = dataSetRuntime.getSchema(typeDesc.getTypeName());
NsObjectOutputTransducer transducer = new NsObjectOutputTransducer(webServiceMockTestFixture.getClientService(), typeDesc.getTypeName());
List<IndexedRecord> indexedRecordList = makeIndexedRecords(clientService, schema, new AbstractNetSuiteTestBase.SimpleObjectComposer<>(Opportunity.class), 10);
for (IndexedRecord indexedRecord : indexedRecordList) {
Opportunity record = (Opportunity) transducer.write(indexedRecord);
assertNsObject(typeDesc, record);
}
}
use of com.netsuite.webservices.test.transactions.sales.Opportunity in project components by Talend.
the class NsObjectInputTransducerTest method testBasic.
@Test
public void testBasic() throws Exception {
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("Opportunity");
final List<Opportunity> recordList = makeNsObjects(new NsObjectComposer<Opportunity>(clientService.getMetaDataSource(), typeDesc), 10);
mockSearchRequestResults(recordList, 100);
Schema schema = NetSuiteDatasetRuntimeImpl.inferSchemaForType(typeDesc.getTypeName(), typeDesc.getFields());
NsObjectInputTransducer transducer = new NsObjectInputTransducer(clientService, schema, typeDesc.getTypeName());
for (Record record : recordList) {
IndexedRecord indexedRecord = transducer.read(record);
assertIndexedRecord(typeDesc, indexedRecord);
}
}
use of com.netsuite.webservices.test.transactions.sales.Opportunity in project components by Talend.
the class NsObjectInputTransducerTest method testDynamicSchemaWithCustomFields.
@Test
public void testDynamicSchemaWithCustomFields() throws Exception {
TestCustomMetaDataSource customMetaDataSource = new TestCustomMetaDataSource(clientService, "Opportunity");
clientService.getMetaDataSource().setCustomMetaDataSource(customMetaDataSource);
TypeDesc basicTypeDesc = clientService.getMetaDataSource().getTypeInfo("Opportunity");
final List<Opportunity> recordList = makeNsObjects(new NsObjectComposer<Opportunity>(clientService.getMetaDataSource(), basicTypeDesc), 10);
mockSearchRequestResults(recordList, 100);
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo(basicTypeDesc.getTypeName());
Schema schema = getDynamicSchema();
NsObjectInputTransducer transducer = new NsObjectInputTransducer(clientService, schema, typeDesc.getTypeName());
SearchResultSet<Record> rs = clientService.newSearch().target(basicTypeDesc.getTypeName()).search();
while (rs.next()) {
Record record = rs.get();
IndexedRecord indexedRecord = transducer.read(record);
assertIndexedRecord(typeDesc, indexedRecord);
}
}
Aggregations