Browse Source
* commit 'fc36f997c76474ba8ae2d6ba81cce4d50f24b81f': KERNEL-1198 新添加方法的单元测试 KERNEL-1198 按要求修改 KERNEL-1198 去除不必要修改修改 KERNEL-1198 按要求修改 KERNEL-1198 JSON插件第二次提交 KERNEL-1198 消除不必要改动 KERNEL-1198 JSON插件第一波FineKit提交。pull/19/head
superman
5 years ago
7 changed files with 75 additions and 43 deletions
@ -1,41 +0,0 @@
|
||||
package com.fanruan.api.conf; |
||||
|
||||
import com.fr.config.Configuration; |
||||
import com.fr.config.holder.ConfigChangeListener; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.ValidateProxy; |
||||
import com.fr.transaction.WorkerFacade; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-30 |
||||
* 配置监听管理器 |
||||
*/ |
||||
public class ConfigurationKit { |
||||
|
||||
/** |
||||
* 注册监听配置变化的监听器 |
||||
* |
||||
* @param listener 监听器 |
||||
*/ |
||||
public static void registerListener(ConfigChangeListener listener) { |
||||
ValidateProxy.getInstance().getValidateManager().registerListener(listener); |
||||
} |
||||
|
||||
/** |
||||
* 保存配置 |
||||
* |
||||
* @param type 配置的类型 |
||||
* @param action 保存动作 |
||||
*/ |
||||
public static void modify(Class<? extends Configuration> type, Runner action) { |
||||
Configurations.modify(new WorkerFacade(type) { |
||||
@Override |
||||
public void run() { |
||||
action.run(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fanruan.api.xml; |
||||
|
||||
import com.fr.base.Parameter; |
||||
import com.fr.base.TableData; |
||||
import com.fr.plugin.db.json.core.JSONTableData; |
||||
import com.fr.stable.ParameterProvider; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
import com.fr.stable.xml.StableXMLUtils; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLUtils; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
import com.fr.third.javax.xml.stream.XMLStreamException; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
import static org.junit.Assert.*; |
||||
|
||||
public class XmlKitTest { |
||||
|
||||
@Test |
||||
public void readParameter() { |
||||
try { |
||||
XMLableReader xml = XMLableReader.createXMLableReader("<!-- Edited by XMLSpy® -->\n" + |
||||
"<note>\n" + |
||||
"<Parameter>Tove</Parameter>\n" + |
||||
"<from>Jani</from>\n" + |
||||
"<heading>Reminder</heading>\n" + |
||||
"<body>Don't forget me this weekend!</body>\n" + |
||||
"</note>"); |
||||
Parameter parameter = new Parameter("test", 1); |
||||
StableFactory.registerXMLDescription("Parameter",parameter); |
||||
Parameter p = (Parameter)XmlKit.readParameter(xml); |
||||
Assert.assertTrue(p.getName().equals("test")); |
||||
} catch (XMLStreamException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue