Package com.sematext.searchschemer.writer

Source Code of com.sematext.searchschemer.writer.SenseidbIndexStructureWriterTest

package com.sematext.searchschemer.writer;

import java.io.StringWriter;

import junit.framework.TestCase;

import org.junit.Test;

import com.sematext.searchschemer.index.BasicIndexStructure;
import com.sematext.searchschemer.index.IndexStructure;
import com.sematext.searchschemer.index.sensidb.SenseiDBFieldAttributes;

public class SenseidbIndexStructureWriterTest extends TestCase {
  @Test
  public void testWriteNonDynamic() throws Exception {
    IndexStructure structure = new BasicIndexStructure();
    structure.addField("cat", new SenseiDBFieldAttributes("cat", "string", "analyzed", "yes"), false);

    StringWriter writer = new StringWriter();
    SenseidbIndexStructureWriter senseiIndexStructureWriter = new SenseidbIndexStructureWriter();
    senseiIndexStructureWriter.write(structure, writer);

    assertEquals("Single column table write test",
        "<table uid=\"id\">\n <column name=\"cat\" type=\"string\" />\n</table>", writer.toString());
  }

  @Test
  public void testWriteNonDynamicMultiple() throws Exception {
    IndexStructure structure = new BasicIndexStructure();
    structure.addField("cat", new SenseiDBFieldAttributes("cat", "string", "analyzed", "yes"), false);
    structure.addField("menu", new SenseiDBFieldAttributes("menu", "string", "no", "yes"), false);

    StringWriter writer = new StringWriter();
    SenseidbIndexStructureWriter senseiIndexStructureWriter = new SenseidbIndexStructureWriter();
    senseiIndexStructureWriter.write(structure, writer);

    assertEquals(
        "Single column table write test",
        "<table uid=\"id\">\n <column name=\"cat\" type=\"string\" />\n <column name=\"menu\" type=\"string\" />\n</table>",
        writer.toString());
  }
}
TOP

Related Classes of com.sematext.searchschemer.writer.SenseidbIndexStructureWriterTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.