填充初始化数据

This commit is contained in:
mll 2022-09-15 21:32:23 +08:00
parent f164e7954b
commit 5266cd93de
4 changed files with 17 additions and 6 deletions

View File

@ -40,11 +40,20 @@ public class NacosXmlELParser extends ClassXmlFlowELParser {
if (StrUtil.isBlank(nacosParserVO.getServerAddr())){ if (StrUtil.isBlank(nacosParserVO.getServerAddr())){
nacosParserVO.setServerAddr("127.0.0.1:8848"); nacosParserVO.setServerAddr("127.0.0.1:8848");
} }
if (StrUtil.isBlank(nacosParserVO.getNamespace())){
nacosParserVO.setNamespace("");
}
if (StrUtil.isBlank(nacosParserVO.getDataId())){ if (StrUtil.isBlank(nacosParserVO.getDataId())){
nacosParserVO.setDataId("LiteFLow"); nacosParserVO.setDataId("LiteFLow");
} }
if (StrUtil.isBlank(nacosParserVO.getGroup())){ if (StrUtil.isBlank(nacosParserVO.getGroup())){
nacosParserVO.setGroup("LiteFLowConfig"); nacosParserVO.setGroup("LITE_FLOW_GROUP");
}
if (StrUtil.isBlank(nacosParserVO.getUsername())){
nacosParserVO.setUsername("");
}
if (StrUtil.isBlank(nacosParserVO.getPassword())){
nacosParserVO.setPassword("");
} }
helper = new NacosParserHelper(nacosParserVO, parseConsumer); helper = new NacosParserHelper(nacosParserVO, parseConsumer);
}catch (Exception e){ }catch (Exception e){

View File

@ -43,6 +43,9 @@ public class NacosParserHelper {
try{ try{
Properties properties = new Properties(); Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, nacosParserVO.getServerAddr()); properties.put(PropertyKeyConst.SERVER_ADDR, nacosParserVO.getServerAddr());
properties.put(PropertyKeyConst.NAMESPACE,nacosParserVO.getNamespace());
properties.put(PropertyKeyConst.USERNAME,nacosParserVO.getUsername());
properties.put(PropertyKeyConst.PASSWORD,nacosParserVO.getPassword());
this.configService = NacosFactory.createConfigService(properties); this.configService = NacosFactory.createConfigService(properties);
CONFIG_MAP.put("Content",configService.getConfig(nacosParserVO.getDataId(), nacosParserVO.getGroup(), 3000L)); CONFIG_MAP.put("Content",configService.getConfig(nacosParserVO.getDataId(), nacosParserVO.getGroup(), 3000L));
}catch (Exception e){ }catch (Exception e){
@ -86,7 +89,6 @@ public class NacosParserHelper {
} }
}); });
}catch (Exception ex){ }catch (Exception ex){
LOG.error("listener Exception {} " , ex.getMessage());
throw new NacosException(ex.getMessage()); throw new NacosException(ex.getMessage());
} }
} }

View File

@ -34,11 +34,11 @@ public class NacosWithXmlELSpringbootTest extends BaseTest {
public void testNacosWithXml() throws Exception { public void testNacosWithXml() throws Exception {
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
Assert.assertTrue(response.isSuccess()); Assert.assertTrue(response.isSuccess());
Assert.assertEquals("a==>b==>c", response.getExecuteStepStr()); System.out.println(" start " + response.getExecuteStepStr());
for (int i = 0 ; i < 10; i ++){ for (int i = 0 ; i < 10; i ++){
Thread.sleep(10000L); Thread.sleep(10000L);
response = flowExecutor.execute2Resp("chain1", "arg"); response = flowExecutor.execute2Resp("chain1", "arg");
System.out.println(" i " + response.getExecuteStepStr()); System.out.println(" i " + i + response.getExecuteStepStr());
} }
} }
} }

View File

@ -1,3 +1,3 @@
#liteflow.rule-source-ext-data={"serverAddr":"192.168.10.147:8848"} liteflow.rule-source-ext-data={"serverAddr":"192.168.10.147:8848","dataId":"LiteFlow","group":"LITE_FLOW_GROUP"}
#liteflow.rule-source-ext-data={"serverAddr":"192.168.10.147:8848","dataId":"LiteFlow","group":"LITE_FLOW_GROUP"} #liteflow.rule-source-ext-data={"serverAddr":"192.168.10.147:8848","dataId":"LiteFlow","group":"LITE_FLOW_GROUP"}
liteflow.rule-source-ext-data={"serverAddr":"192.168.10.147:8848","dataId":"LiteFlow","group":"LITE_FLOW_GROUP","namespace":"","username":"","password":""} #liteflow.rule-source-ext-data={"serverAddr":"192.168.10.147:8848","dataId":"LiteFlow","group":"LITE_FLOW_GROUP","namespace":"","username":"","password":""}