use of com.qlangtech.async.message.client.consumer.RocketMQListenerFactory in project plugins by qlangtech.
the class TestPlugin method testReceiceRequestFromClient.
public void testReceiceRequestFromClient() throws Exception {
com.alibaba.fastjson.JSONArray jsonArray = null;
com.alibaba.fastjson.JSONObject jsonObject = null;
com.alibaba.fastjson.JSONObject valJ = null;
String impl = null;
PropertyType attrDesc = null;
Descriptor descriptor = null;
JSONArray vals = null;
String attr = null;
String attrVal = null;
TIS tis = TIS.get();
// IncrComponent incrComponent = tis.loadIncrComponent(collection);
// incrComponent.setMqListenerFactory();
Describable describable = null;
try (InputStream input = TestPlugin.class.getResourceAsStream("RocketMQListenerFactory.json")) {
assertNotNull(input);
jsonArray = JSONArray.parseArray(IOUtils.toString(input, TisUTF8.getName()));
for (int i = 0; i < jsonArray.size(); i++) {
// 创建一个item
jsonObject = jsonArray.getJSONObject(i);
describable = (Describable) parseDescribable(jsonObject).instance;
}
}
assertNotNull(describable);
RocketMQListenerFactory mqListenerFactory = (RocketMQListenerFactory) describable;
assertEquals(MQ_TOPIC, mqListenerFactory.getMqTopic());
assertEquals(NamesrvAddr, mqListenerFactory.getNamesrvAddr());
assertEquals(consumeId, mqListenerFactory.consumeName);
assertNotNull(mqListenerFactory.getDeserialize());
}
use of com.qlangtech.async.message.client.consumer.RocketMQListenerFactory in project plugins by qlangtech.
the class TestIncrComponent method testLoad.
public void testLoad() {
// IncrComponent incrComponent = TIS.get().loadIncrComponent(collection);
IPluginStore<MQListenerFactory> pluginStore = TIS.getPluginStore(collection, MQListenerFactory.class);
// assertNotNull(incrComponent);
// incrComponent.getMqListenerFactory();
List<MQListenerFactory> mqListenerFactoryList = pluginStore.getPlugins();
assertEquals(1, mqListenerFactoryList.size());
MQListenerFactory mqListenerFactory = mqListenerFactoryList.stream().findFirst().get();
assertTrue(mqListenerFactory instanceof RocketMQListenerFactory);
RocketMQListenerFactory rmFactory = (RocketMQListenerFactory) mqListenerFactory;
assertEquals("c_otter_binlogorder_solr", rmFactory.getConsumeName());
assertEquals("otter_binlogorder", rmFactory.getMqTopic());
assertEquals("10.1.21.148:9876", rmFactory.getNamesrvAddr());
assertTrue(rmFactory.getDeserialize() instanceof DefaultJSONFormatDeserialize);
// assertEquals(collection, incrComponent.getCollection());
}
use of com.qlangtech.async.message.client.consumer.RocketMQListenerFactory in project plugins by qlangtech.
the class TestPlugin method testSaveAndLoad.
public void testSaveAndLoad() throws IOException {
// FileUtils.forceMkdir(tmpDir);
try {
// IncrComponent incrComponent = createIncrComponent();
// TIS.get().saveComponent(collection, incrComponent);
// incrComponent = TIS.get().loadIncrComponent(collection);
IPluginStore<MQListenerFactory> pluginStore = TIS.getPluginStore(collection, MQListenerFactory.class);
// incrComponent.getMqListenerFactory();
List<MQListenerFactory> mqListenerFactory = pluginStore.getPlugins();
assertEquals(1, mqListenerFactory.size());
RocketMQListenerFactory rocketMQListenerFactory = (RocketMQListenerFactory) mqListenerFactory.get(0);
// assertEquals(collection, incrComponent.getCollection());
assertEquals(consumeId, rocketMQListenerFactory.consumeName);
assertEquals(MQ_TOPIC, rocketMQListenerFactory.getMqTopic());
assertEquals(NamesrvAddr, rocketMQListenerFactory.getNamesrvAddr());
assertNotNull(rocketMQListenerFactory.getDeserialize());
assertTrue(rocketMQListenerFactory.getDeserialize() instanceof DefaultJSONFormatDeserialize);
} finally {
// FileUtils.forceDelete(tmpDir);
}
}
Aggregations