@@ -0,0 +1,2160 @@
+package com.yahoo.searchdefinition.processing;%0A%0Aimport com.yahoo.document.DataType;%0Aimport com.yahoo.document.Field;%0Aimport com.yahoo.searchdefinition.Search;%0Aimport com.yahoo.searchdefinition.SearchBuilder;%0Aimport com.yahoo.searchdefinition.document.SDDocumentType;%0Aimport com.yahoo.searchdefinition.document.TemporaryReferenceField;%0Aimport com.yahoo.searchdefinition.parser.ParseException;%0Aimport org.junit.Test;%0A%0Aimport static org.hamcrest.Matchers.instanceOf;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertThat;%0A%0A/**%0A * @author bjorncs%0A */%0Apublic class ReferenceFieldTestCase %7B%0A%0A    @Test%0A    public void reference_fields_are_parsed_from_search_definition() throws ParseException %7B%0A        SearchBuilder builder = new SearchBuilder();%0A        String sdContent =%0A                %22search ad %7B%5Cn%22 +%0A                %22  document ad %7B%5Cn%22 +%0A                %22    field campaign_ref type reference%3Ccampaign%3E %7B%7D%5Cn%22 +%0A                %22    field salesperson_ref type reference%3Csalesperson%3E %7B%7D%5Cn%22 +%0A                %22  %7D%5Cn%22 +%0A                %22%7D%22;%0A        builder.importString(sdContent);%0A        builder.build();%0A        Search search = builder.getSearch();%0A        assertSearchContainsReferenceField(%22campaign_ref%22, %22campaign%22, search.getDocument());%0A        assertSearchContainsReferenceField(%22salesperson_ref%22, %22salesperson%22, search.getDocument());%0A    %7D%0A%0A    private static void assertSearchContainsReferenceField(String expectedFieldname,%0A                                                           String referencedDocType,%0A                                                           SDDocumentType documentType) %7B%0A        Field field = documentType.getDocumentType().getField(expectedFieldname);%0A        assertNotNull(%22Field does not exist in document type: %22 + expectedFieldname, field);%0A        DataType dataType = field.getDataType();%0A        assertThat(dataType, instanceOf(TemporaryReferenceField.class));%0A        TemporaryReferenceField refField = (TemporaryReferenceField) dataType;%0A        assertEquals(referencedDocType, refField.getReferencedDocument().getName());%0A    %7D%0A%7D%0A

Add unit test for reference field parsing