Package com.ngdata.hbaseindexer.conf

Examples of com.ngdata.hbaseindexer.conf.FieldDefinition


        solrInputDocCaptor = ArgumentCaptor.forClass(SolrInputDocument.class);
    }

    @Test
    public void testMap() {
        FieldDefinition fieldDefA = new FieldDefinition("fieldA", "cfA:qualifierA", ValueSource.VALUE, "int");
        FieldDefinition fieldDefB = new FieldDefinition("fieldB", "cfB:qualifierB", ValueSource.VALUE,
                DummyValueMapper.class.getName());
        DefaultResultToSolrMapper resultMapper = new DefaultResultToSolrMapper("index-name", Lists.newArrayList(fieldDefA, fieldDefB),
                Collections.<DocumentExtractDefinition> emptyList());

        KeyValue kvA = new KeyValue(ROW, COLUMN_FAMILY_A, QUALIFIER_A, Bytes.toBytes(42));
View Full Code Here


        assertEquals(Lists.newArrayList("A", "B", "C"), fieldB.getValues());
    }

    @Test
    public void testIsRelevantKV_WithoutWildcards() {
        FieldDefinition fieldDef = new FieldDefinition("fieldA", "cf:qualifier", ValueSource.VALUE, "int");
        DefaultResultToSolrMapper resultMapper = new DefaultResultToSolrMapper("index-name", Lists.newArrayList(fieldDef),
                Collections.<DocumentExtractDefinition> emptyList());

        KeyValue relevantKV = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("qualifier"),
                Bytes.toBytes("value"));
View Full Code Here

        assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongQualifier));
    }

    @Test
    public void testIsRelevantKV_WithWildcards() {
        FieldDefinition fieldDef = new FieldDefinition("fieldA", "cf:quali*", ValueSource.VALUE, "int");
        DefaultResultToSolrMapper resultMapper = new DefaultResultToSolrMapper("index-name", Lists.newArrayList(fieldDef),
                Collections.<DocumentExtractDefinition> emptyList());

        KeyValue relevantKV = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("qualifier"),
                Bytes.toBytes("value"));
View Full Code Here

        assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongQualifier));
    }
   
    @Test
    public void testGetGet_SingleCellFieldDefinition() {
        FieldDefinition fieldDef = new FieldDefinition("fieldname", "cf:qualifier", ValueSource.VALUE, "int");
       
        DefaultResultToSolrMapper resultMapper = new DefaultResultToSolrMapper("index-name", Lists.newArrayList(fieldDef),
                        Collections.<DocumentExtractDefinition>emptyList());
        Get get = resultMapper.getGet(ROW);
       
View Full Code Here

        assertTrue(qualifiers.contains(Bytes.toBytes("qualifier")));
    }
   
    @Test
    public void testGetGet_WildcardFieldDefinition() {
        FieldDefinition fieldDef = new FieldDefinition("fieldname", "cf:qual*", ValueSource.VALUE, "int");
       
        DefaultResultToSolrMapper resultMapper = new DefaultResultToSolrMapper("index-name", Lists.newArrayList(fieldDef),
                        Collections.<DocumentExtractDefinition>emptyList());
        Get get = resultMapper.getGet(ROW);
       
View Full Code Here

    }
   
    @Test
    public void testContainsRequiredData_True() {
        DefaultResultToSolrMapper resultToSolrMapper = new DefaultResultToSolrMapper("index-name",
                Lists.newArrayList(new FieldDefinition("fieldname", "cfA:qualifierA", ValueSource.VALUE, "int")),
                        Collections.<DocumentExtractDefinition>emptyList());
       
        Result result = newResult(Lists.newArrayList(new KeyValue(ROW, COLUMN_FAMILY_A, QUALIFIER_A, Bytes.toBytes("value"))));
       
        assertTrue(resultToSolrMapper.containsRequiredData(result));
View Full Code Here

   
    @Test
    public void testContainsRequiredData_False() {
        // With a wildcard we can never know if a Result contains all required data to perform indexing
        DefaultResultToSolrMapper resultToSolrMapper = new DefaultResultToSolrMapper("index-name",
                Lists.newArrayList(new FieldDefinition("fieldname", "cfA:quali*", ValueSource.VALUE, "int")),
                        Collections.<DocumentExtractDefinition>emptyList());
       
        Result result = newResult(Lists.newArrayList(new KeyValue(ROW, COLUMN_FAMILY_A, QUALIFIER_A, Bytes.toBytes("value"))));
       
        assertFalse(resultToSolrMapper.containsRequiredData(result));
View Full Code Here

        assertEquals(expectedMap, toRecord(solrDocument).getFields());
    }

    @Test
    public void testIsRelevantKV_WithoutWildcards() {
        FieldDefinition fieldDef = new FieldDefinition("fieldA", "cf:qualifier", ValueSource.VALUE, "byte[]");

        MorphlineResultToSolrMapper resultMapper = createMorphlineMapper(fieldDef);

        KeyValue relevantKV = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("qualifier"),
                Bytes.toBytes("value"));
View Full Code Here

        assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongQualifier));
    }

    @Test
    public void testIsRelevantKV_WithWildcards() {
        FieldDefinition fieldDef = new FieldDefinition("fieldA", "cf:quali*", ValueSource.QUALIFIER, "int");
        MorphlineResultToSolrMapper resultMapper = createMorphlineMapper(fieldDef);

        KeyValue relevantKV = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("cf"), Bytes.toBytes("qualifier"),
                Bytes.toBytes("value"));
        KeyValue notRelevantKV_WrongFamily = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("wrongcf"),
View Full Code Here

        assertFalse(resultMapper.isRelevantKV(notRelevantKV_WrongQualifier));
    }
   
    @Test
    public void testGetGet_SingleCellFieldDefinition() {
        FieldDefinition fieldDef = new FieldDefinition("fieldname", "cf:qualifier", ValueSource.VALUE, "int");
       
        MorphlineResultToSolrMapper resultMapper = createMorphlineMapper(fieldDef);
        Get get = resultMapper.getGet(ROW);
       
        assertArrayEquals(ROW, get.getRow());
View Full Code Here

TOP

Related Classes of com.ngdata.hbaseindexer.conf.FieldDefinition

Copyright © 2018 www.massapicom. 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.