Package com.ngdata.sep

Examples of com.ngdata.sep.SepEvent


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

        sepConsumer.replicateLogEntries(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


        sepConsumer.replicateLogEntries(new HLog.Entry[]{hlogEntryBeforeTimestamp});
        sepConsumer.replicateLogEntries(new HLog.Entry[]{hlogEntryOnTimestamp});
        sepConsumer.replicateLogEntries(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

        sepConsumer.replicateLogEntries(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);

        sepConsumer.replicateLogEntries(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

        indexer = new RowBasedIndexer("row-based", indexerConf, TABLE_NAME, mapper, tablePool, null, solrWriter);
    }
   
    private RowData createEventRowData(String row, KeyValue... keyValues) {
        return new SepEventRowData(
                new SepEvent(Bytes.toBytes(TABLE_NAME),
                       Bytes.toBytes(row), Lists.newArrayList(keyValues), null));
    }
View Full Code Here

        indexer = new ColumnBasedIndexer("column-based", indexerConf, TABLE_NAME, mapper, null, solrWriter);
    }

    private RowData createEventRowData(String row, KeyValue... keyValues) {
        return new SepEventRowData(
                new SepEvent(TABLE_NAME.getBytes(Charsets.UTF_8),
                        row.getBytes(Charsets.UTF_8), Lists.newArrayList(keyValues), null));
    }
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

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

                final SepEvent sepEvent = new SepEvent(tableName, keyValues.get(0).getRow(), keyValues,
                        payloadPerRowKey.get(rowKeyBuffer));
                eventExecutor.scheduleSepEvent(sepEvent);
                lastProcessedTimestamp = Math.max(lastProcessedTimestamp, entry.getKey().getWriteTime());
            }
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.