use of com.netsuite.webservices.test.platform.core.CustomRecordRef in project components by Talend.
the class NsRefTest method testCustomRecordRef.
@Test
public void testCustomRecordRef() {
NsRef ref = new NsRef(RefType.CUSTOM_RECORD_REF);
ref.setTypeId("1001");
ref.setInternalId("10001");
ref.setExternalId(UUID.randomUUID().toString());
ref.setScriptId("custrecord25");
CustomRecordRef customRecordRef = (CustomRecordRef) ref.toNativeRef(basicMetaData);
assertNotNull(customRecordRef);
assertNull(ref.getType());
assertEquals(ref.getTypeId(), customRecordRef.getTypeId());
assertEquals(ref.getInternalId(), customRecordRef.getInternalId());
assertEquals(ref.getExternalId(), customRecordRef.getExternalId());
assertEquals(ref.getScriptId(), customRecordRef.getScriptId());
NsRef ref2 = NsRef.fromNativeRef(customRecordRef);
assertNotNull(ref2);
assertEquals(customRecordRef.getTypeId(), ref2.getTypeId());
assertEquals(customRecordRef.getInternalId(), ref2.getInternalId());
assertEquals(customRecordRef.getExternalId(), ref2.getExternalId());
assertNull(ref2.getScriptId());
}
use of com.netsuite.webservices.test.platform.core.CustomRecordRef in project components by Talend.
the class NetSuiteOutputTransducerTest method testCustomRecordRef.
@Test
public void testCustomRecordRef() throws Exception {
CustomMetaDataSource customMetaDataSource = new TestCustomMetaDataSource(clientService);
clientService.getMetaDataSource().setCustomMetaDataSource(customMetaDataSource);
NetSuiteDatasetRuntime dataSetRuntime = new NetSuiteDatasetRuntimeImpl(clientService.getMetaDataSource());
mockGetRequestResults(null);
TypeDesc customTypeDesc = clientService.getMetaDataSource().getTypeInfo("custom_record_type_1");
Schema schema = dataSetRuntime.getSchemaForDelete(customTypeDesc.getTypeName());
NsObjectOutputTransducer transducer = new NsObjectOutputTransducer(webServiceMockTestFixture.getClientService(), customTypeDesc.getTypeName());
transducer.setReference(true);
GenericRecord indexedRecordToAdd = new GenericData.Record(schema);
indexedRecordToAdd.put("InternalId", "123456789");
List<IndexedRecord> indexedRecordList = new ArrayList<>();
indexedRecordList.add(indexedRecordToAdd);
for (IndexedRecord indexedRecord : indexedRecordList) {
CustomRecordRef recordRef = (CustomRecordRef) transducer.write(indexedRecord);
assertNotNull(recordRef.getInternalId());
assertNotNull(recordRef.getTypeId());
}
}
Aggregations