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");
}
Aggregations