use of com.netsuite.webservices.test.setup.customization.CustomFieldType in project components by Talend.
the class CustomMetaDataSourceTest method createCustomRecordType.
protected CustomRecordType createCustomRecordType(Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customFieldSpecs) throws Exception {
CustomRecordType customRecordType = new CustomRecordType();
customRecordType.setScriptId("custrecord1");
customRecordType.setInternalId("201");
Map<String, CustomFieldType> customFieldTypeMap = createCustomFieldTypes(customFieldSpecs);
customRecordType.setCustomFieldList(new CustomRecordTypeFieldList());
for (CustomFieldType customFieldType : customFieldTypeMap.values()) {
customRecordType.getCustomFieldList().getCustomField().add((CustomRecordCustomField) customFieldType);
}
return customRecordType;
}
use of com.netsuite.webservices.test.setup.customization.CustomFieldType in project components by Talend.
the class CustomFieldAdaptersTest method testAdapterForGenericCustomField.
@Test
public void testAdapterForGenericCustomField() {
OtherCustomField customField = new OtherCustomField();
customField.setFieldType(CustomizationFieldType.HYPERLINK);
DefaultCustomFieldAdapter<CustomFieldType> adapter1 = new DefaultCustomFieldAdapter<>(BasicRecordType.OTHER_CUSTOM_FIELD, true);
assertTrue(adapter1.appliesTo("opportunity", customField));
assertEquals(CustomFieldRefType.STRING, adapter1.apply(customField));
DefaultCustomFieldAdapter<CustomFieldType> adapter2 = new DefaultCustomFieldAdapter<>(BasicRecordType.OTHER_CUSTOM_FIELD, false);
assertFalse(adapter2.appliesTo("opportunity", customField));
}
use of com.netsuite.webservices.test.setup.customization.CustomFieldType in project components by Talend.
the class NetSuiteMockTestBase method createCustomFieldTypes.
protected Map<String, CustomFieldType> createCustomFieldTypes(Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customFieldSpecs) throws Exception {
Map<String, CustomFieldType> customFieldTypeMap = new HashMap<>();
for (CustomFieldSpec<RecordType, CustomizationFieldType> spec : customFieldSpecs.values()) {
CustomFieldType fieldRecord = (CustomFieldType) spec.getFieldTypeClass().newInstance();
Beans.setProperty(fieldRecord, "internalId", spec.getInternalId());
fieldRecord.setScriptId(spec.getScriptId());
fieldRecord.setFieldType(spec.getFieldType());
if (spec.getAppliesTo() != null) {
for (String appliesTo : spec.getAppliesTo()) {
Beans.setProperty(fieldRecord, appliesTo, Boolean.TRUE);
}
}
customFieldTypeMap.put(fieldRecord.getScriptId(), fieldRecord);
}
return customFieldTypeMap;
}
Aggregations