Search in sources :

Example 1 with CustomRecordType

use of com.netsuite.webservices.test.setup.customization.CustomRecordType in project components by Talend.

the class CustomMetaDataSourceTest method testGetCustomRecordTypes.

@Test
public void testGetCustomRecordTypes() throws Exception {
    Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customRecordFieldSpecs = createCustomRecordFieldSpecs();
    CustomRecordType customRecordType = createCustomRecordType(customRecordFieldSpecs);
    customMetaDataRetriever.setCustomRecordType(customRecordType);
    customMetaDataRetriever.setCustomRecordFieldSpecs(customRecordFieldSpecs);
    Collection<CustomRecordTypeInfo> recordTypeInfos = customMetaDataSource.getCustomRecordTypes();
    assertNotNull(recordTypeInfos);
    assertEquals(1, recordTypeInfos.size());
    CustomRecordTypeInfo recordTypeInfo1 = recordTypeInfos.iterator().next();
    assertNotNull(recordTypeInfo1.getName());
    assertNotNull(recordTypeInfo1.getCustomizationRef());
    assertEquals(customRecordType.getScriptId(), recordTypeInfo1.getName());
    assertEquals(customRecordType.getScriptId(), recordTypeInfo1.getCustomizationRef().getScriptId());
    assertEquals(customRecordType.getInternalId(), recordTypeInfo1.getCustomizationRef().getInternalId());
}
Also used : CustomRecordType(com.netsuite.webservices.test.setup.customization.CustomRecordType) CustomFieldSpec(org.talend.components.netsuite.CustomFieldSpec) CustomRecordTypeInfo(org.talend.components.netsuite.client.model.CustomRecordTypeInfo) Test(org.junit.Test)

Example 2 with CustomRecordType

use of com.netsuite.webservices.test.setup.customization.CustomRecordType 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;
}
Also used : CustomRecordType(com.netsuite.webservices.test.setup.customization.CustomRecordType) CustomRecordTypeFieldList(com.netsuite.webservices.test.setup.customization.CustomRecordTypeFieldList) CustomFieldType(com.netsuite.webservices.test.setup.customization.CustomFieldType)

Example 3 with CustomRecordType

use of com.netsuite.webservices.test.setup.customization.CustomRecordType in project components by Talend.

the class CustomMetaDataSourceTest method testGetCustomRecordType.

@Test
public void testGetCustomRecordType() throws Exception {
    Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customRecordFieldSpecs = createCustomRecordFieldSpecs();
    CustomRecordType customRecordType = createCustomRecordType(customRecordFieldSpecs);
    customMetaDataRetriever.setCustomRecordType(customRecordType);
    customMetaDataRetriever.setCustomRecordFieldSpecs(customRecordFieldSpecs);
    CustomRecordTypeInfo recordTypeInfo = customMetaDataSource.getCustomRecordType(customRecordType.getScriptId());
    assertNotNull(recordTypeInfo);
    Map<String, CustomFieldDesc> customFieldDescMap = customMetaDataSource.getCustomFields(recordTypeInfo);
    assertNotNull(customFieldDescMap);
    for (CustomFieldSpec customFieldSpec : customRecordFieldSpecs.values()) {
        CustomFieldDesc customFieldDesc = customFieldDescMap.get(customFieldSpec.getScriptId());
        assertNotNull(customFieldDesc);
        assertNotNull(customFieldDesc.getCustomizationRef());
        assertEquals(customFieldSpec.getScriptId(), customFieldDesc.getName());
        assertEquals(customFieldSpec.getInternalId(), customFieldDesc.getCustomizationRef().getInternalId());
    }
}
Also used : CustomRecordType(com.netsuite.webservices.test.setup.customization.CustomRecordType) CustomFieldSpec(org.talend.components.netsuite.CustomFieldSpec) CustomFieldDesc(org.talend.components.netsuite.client.model.CustomFieldDesc) CustomRecordTypeInfo(org.talend.components.netsuite.client.model.CustomRecordTypeInfo) Test(org.junit.Test)

Aggregations

CustomRecordType (com.netsuite.webservices.test.setup.customization.CustomRecordType)3 Test (org.junit.Test)2 CustomFieldSpec (org.talend.components.netsuite.CustomFieldSpec)2 CustomRecordTypeInfo (org.talend.components.netsuite.client.model.CustomRecordTypeInfo)2 CustomFieldType (com.netsuite.webservices.test.setup.customization.CustomFieldType)1 CustomRecordTypeFieldList (com.netsuite.webservices.test.setup.customization.CustomRecordTypeFieldList)1 CustomFieldDesc (org.talend.components.netsuite.client.model.CustomFieldDesc)1