Package com.ngdata.sep

Examples of com.ngdata.sep.SepEvent


        HLog.Entry hlogEntry = createHlogEntry(TABLE_NAME, new KeyValue(rowKey, DATA_COLFAM,
                PAYLOAD_QUALIFIER, payloadData));

        ReplicationProtbufUtil.replicateWALEntry(sepConsumer, new HLog.Entry[]{hlogEntry});

        SepEvent expectedSepEvent = new SepEvent(TABLE_NAME, rowKey,
                hlogEntry.getEdit().getKeyValues(), payloadData);

        verify(eventListener).processEvents(Lists.newArrayList(expectedSepEvent));
    }
View Full Code Here


        ReplicationProtbufUtil.replicateWALEntry(sepConsumer, new HLog.Entry[]{hlogEntryBeforeTimestamp});
        ReplicationProtbufUtil.replicateWALEntry(sepConsumer, new HLog.Entry[]{hlogEntryOnTimestamp});
        ReplicationProtbufUtil.replicateWALEntry(sepConsumer, new HLog.Entry[]{hlogEntryAfterTimestamp});

        SepEvent expectedEventOnTimestamp = new SepEvent(TABLE_NAME, rowKey,
                hlogEntryOnTimestamp.getEdit().getKeyValues(), payloadDataOnTimestamp);
        SepEvent expectedEventAfterTimestamp = new SepEvent(TABLE_NAME, rowKey,
                hlogEntryAfterTimestamp.getEdit().getKeyValues(), payloadDataAfterTimestamp);

        // Event should be published for data on or after the subscription timestamp, but not before
        verify(eventListener, times(1)).processEvents(Lists.newArrayList(expectedEventOnTimestamp));
        verify(eventListener, times(1)).processEvents(Lists.newArrayList(expectedEventAfterTimestamp));
View Full Code Here

        ReplicationProtbufUtil.replicateWALEntry(sepConsumer, new HLog.Entry[]{entry});

        // We should get the first payload in our event (and the second one will be ignored, although the KeyValue will
        // be present in the event
        SepEvent expectedEvent = new SepEvent(TABLE_NAME, rowKey, Lists.newArrayList(kvA, kvB),
                Bytes.toBytes("A"));

        verify(eventListener).processEvents(Lists.newArrayList(expectedEvent));
    }
View Full Code Here

        HLog.Entry entry = createHlogEntry(TABLE_NAME, kvA, kvB);

        ReplicationProtbufUtil.replicateWALEntry(sepConsumer, new HLog.Entry[]{entry});

        SepEvent expectedEventA = new SepEvent(TABLE_NAME, rowKeyA, Lists.newArrayList(kvA),
                Bytes.toBytes("data"));
        SepEvent expectedEventB = new SepEvent(TABLE_NAME, rowKeyB, Lists.newArrayList(kvB),
                Bytes.toBytes("data"));

        verify(eventListener).processEvents(Lists.newArrayList(expectedEventA, expectedEventB));
    }
View Full Code Here

       
        List<SepEvent> events = eventListener.getEvents();

        assertEquals(2, events.size());

        SepEvent eventA, eventB;
        if ("rowA".equals(Bytes.toString(events.get(0).getRow()))) {
            eventA = events.get(0);
            eventB = events.get(1);
        } else {
            eventA = events.get(1);
            eventB = events.get(0);
        }
       
        assertEquals("rowA", Bytes.toString(eventA.getRow()));
        assertEquals("rowB", Bytes.toString(eventB.getRow()));
    }
View Full Code Here

        htable.put(put);
       
        waitForEvents(eventListener, 1);
        waitForEvents(eventListenerWithPayloads, 1);
       
        SepEvent eventWithoutPayload = eventListener.getEvents().get(0);
        SepEvent eventWithPayload = eventListenerWithPayloads.getEvents().get(0);
       
        assertEquals("rowkey", Bytes.toString(eventWithoutPayload.getRow()));
        assertEquals("rowkey", Bytes.toString(eventWithPayload.getRow()));
       
        assertEquals(2, eventWithoutPayload.getKeyValues().size());
        assertEquals(2, eventWithPayload.getKeyValues().size());
       
        assertNull(eventWithoutPayload.getPayload());
        assertEquals("payload", Bytes.toString(eventWithPayload.getPayload()));
    }
View Full Code Here

            }
           
            for (final ByteBuffer rowKeyBuffer : keyValuesPerRowKey.keySet()) {
                final List<KeyValue> keyValues = (List<KeyValue>)keyValuesPerRowKey.get(rowKeyBuffer);

                final SepEvent sepEvent = new SepEvent(tableName.toBytes(), keyValues.get(0).getRow(), keyValues,
                        payloadPerRowKey.get(rowKeyBuffer));
                eventExecutor.scheduleSepEvent(sepEvent);
                lastProcessedTimestamp = Math.max(lastProcessedTimestamp, entry.getKey().getWriteTime());
            }
View Full Code Here

        IndexerConf conf = new IndexerConfBuilder().table(TABLE_A).build();

        Indexer indexer = Indexer.createIndexer("index name", conf, TABLE_A, null, tablePool, null, solrDocumentWriter);
        IndexingEventListener indexingEventListener = new IndexingEventListener(indexer, TABLE_A, false);

        SepEvent event = new SepEvent(Bytes.toBytes(TABLE_B), null, null, null);
        indexingEventListener.processEvents(Collections.singletonList(event));

        verifyZeroInteractions(tableA, tableB, solrDocumentWriter);
    }
View Full Code Here

        Indexer indexer = Indexer.createIndexer("index name", conf, "record", mapper, tablePool, null, solrDocumentWriter);
        IndexingEventListener indexingEventListener = new IndexingEventListener(indexer, TABLE_A, false);

        List<KeyValue> kvs = Lists.newArrayList(new KeyValue(Bytes.toBytes("row1"), Bytes.toBytes("cf"),
                Bytes.toBytes("qual"), Bytes.toBytes("value")));
        SepEvent event = new SepEvent(Bytes.toBytes(TABLE_A), Bytes.toBytes("row1"), kvs, null);
        indexingEventListener.processEvents(Collections.singletonList(event));

        verify(solrDocumentWriter).deleteById(-1, Collections.singletonList("row1"));
        verifyNoMoreInteractions(solrDocumentWriter);
    }
View Full Code Here

        Indexer indexer = Indexer.createIndexer("index name", conf, "record", mapper, tablePool, null, solrDocumentWriter);
        IndexingEventListener indexingEventListener = new IndexingEventListener(indexer, TABLE_A, false);

        List<KeyValue> kvs = Lists.newArrayList(new KeyValue(Bytes.toBytes("row1"), Bytes.toBytes("cf"),
                Bytes.toBytes("qual"), Bytes.toBytes("val")));
        SepEvent event = new SepEvent(Bytes.toBytes(TABLE_A), Bytes.toBytes("row1"), kvs, null);
        indexingEventListener.processEvents(Collections.singletonList(event));

        ArgumentCaptor<Map> addedDocumentsCaptor = ArgumentCaptor.forClass(Map.class);
        verify(solrDocumentWriter).add(eq(-1), addedDocumentsCaptor.capture());
        Map<String, SolrInputDocument> addedDocuments = addedDocumentsCaptor.getValue();
View Full Code Here

TOP

Related Classes of com.ngdata.sep.SepEvent

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.