Search in sources :

Example 1 with RmqConnectorConfig

use of org.apache.rocketmq.replicator.config.RmqConnectorConfig in project rocketmq-externals by apache.

the class RmqSourceReplicatorTest method testGenerateTopic.

@Test
public void testGenerateTopic() throws NoSuchFieldException {
    RmqSourceReplicator rmqSourceReplicator = Mockito.spy(RmqSourceReplicator.class);
    RmqConnectorConfig config = new RmqConnectorConfig();
    KeyValue kv = new DefaultKeyValue();
    kv.put(ConfigDefine.CONN_TOPIC_RENAME_FMT, "${topic}.replica");
    config.validate(kv);
    Field field = RmqSourceReplicator.class.getDeclaredField("replicatorConfig");
    FieldSetter.setField(rmqSourceReplicator, field, config);
    String dstTopic = rmqSourceReplicator.generateTargetTopic("dest");
    assertThat(dstTopic).isEqualTo("dest.replica");
}
Also used : DefaultKeyValue(io.openmessaging.internal.DefaultKeyValue) Field(java.lang.reflect.Field) RmqConnectorConfig(org.apache.rocketmq.replicator.config.RmqConnectorConfig) KeyValue(io.openmessaging.KeyValue) DefaultKeyValue(io.openmessaging.internal.DefaultKeyValue) Test(org.junit.Test)

Aggregations

KeyValue (io.openmessaging.KeyValue)1 DefaultKeyValue (io.openmessaging.internal.DefaultKeyValue)1 Field (java.lang.reflect.Field)1 RmqConnectorConfig (org.apache.rocketmq.replicator.config.RmqConnectorConfig)1 Test (org.junit.Test)1