Search in sources :

Example 6 with RedisEvent

use of org.apache.rocketmq.connect.redis.pojo.RedisEvent in project rocketmq-externals by apache.

the class RedisSourceTaskTest method testTask.

@Test
public void testTask() throws Exception {
    if (this.task != null) {
        RedisEvent redisEvent = getRedisEvent();
        this.task.getEventProcessor().commit(redisEvent);
        Collection<SourceDataEntry> col = this.task.poll();
        Assert.assertNotNull(col);
        Assert.assertEquals(1, col.size());
        Assert.assertNotNull(this.task.getConfig());
    }
}
Also used : SourceDataEntry(io.openmessaging.connector.api.data.SourceDataEntry) RedisEvent(org.apache.rocketmq.connect.redis.pojo.RedisEvent) Test(org.junit.Test)

Example 7 with RedisEvent

use of org.apache.rocketmq.connect.redis.pojo.RedisEvent in project rocketmq-externals by apache.

the class ProcessorTest method test.

@Test
public void test() {
    processor = getProcessor();
    RedisEvent event = getRedisEvent();
    Exception ex = null;
    try {
        processor.commit(event);
    } catch (Exception e) {
        e.printStackTrace();
        ex = e;
    }
    Assert.assertNull(ex);
    try {
        KVEntry entry = processor.poll();
        Assert.assertEquals("key", entry.getKey());
        Assert.assertEquals("value", entry.getValue());
        Assert.assertEquals("c18cece63c7b16851a6f387f52dbbb9eee07e46f", entry.getSourceId());
    } catch (InterruptedException e) {
        e.printStackTrace();
        ex = e;
    } catch (Exception e) {
        e.printStackTrace();
    }
    Assert.assertNull(ex);
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) RedisEvent(org.apache.rocketmq.connect.redis.pojo.RedisEvent) IOException(java.io.IOException) JedisConnectionException(redis.clients.jedis.exceptions.JedisConnectionException) Test(org.junit.Test)

Aggregations

RedisEvent (org.apache.rocketmq.connect.redis.pojo.RedisEvent)7 Test (org.junit.Test)4 IOException (java.io.IOException)3 KeyStringValueString (com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString)2 KVEntry (org.apache.rocketmq.connect.redis.pojo.KVEntry)2 JedisConnectionException (redis.clients.jedis.exceptions.JedisConnectionException)2 SourceDataEntry (io.openmessaging.connector.api.data.SourceDataEntry)1 DefaultRedisEventProcessor (org.apache.rocketmq.connect.redis.processor.DefaultRedisEventProcessor)1