Java 多用途弹药的载荷特性

Java 多用途弹药的载荷特性,java,mule,munit,Java,Mule,Munit,我的流程中有一些占位符。这些占位符的值在属性文件中指定(在类路径中)。我正在用java做munit。当前,这些占位符未被属性文件中的值替换。知道运行munit时如何加载此文件吗 我的军需品是这样的: Class MyClass extends FunctionalMunitSuite{ @Override protected String getConfigResources() { //try 1[gave give value pairs directly

我的流程中有一些占位符。这些占位符的值在属性文件中指定(在类路径中)。我正在用java做munit。当前,这些占位符未被属性文件中的值替换。知道运行munit时如何加载此文件吗

我的军需品是这样的:

Class MyClass extends FunctionalMunitSuite{

    @Override
    protected String getConfigResources() {

        //try 1[gave give value pairs directly]: didnt worked
         System.getProperties().put("prop.key", "value");

         //try2[load prop files]:didn't worked
         prop.load(this.getClass().getResourceAsStream("mypropertyfile.properties"));
         System.setProperties(prop); 
    }

}
<context:property-placeholder ignore-resource-not-found="true" location="wmo-mule-app.properties,wmo-mule-app-unit-test.properties" />

当前您的文件可能位于/src/main/resources
在重写
getConfigResources()
中,尝试将其放入/src/test/resources

中,指定一个
test config.xml
,其中包含模拟连接器和属性文件的上下文属性占位符。将该测试属性文件存储在src/test/resources中

@Override
    protected String getConfigResources() {
        return "mule-config-test.xml" + ",actual-flow-to-test.xml";
    }
mule config test.xml
中,定义测试属性文件如下:

Class MyClass extends FunctionalMunitSuite{

    @Override
    protected String getConfigResources() {

        //try 1[gave give value pairs directly]: didnt worked
         System.getProperties().put("prop.key", "value");

         //try2[load prop files]:didn't worked
         prop.load(this.getClass().getResourceAsStream("mypropertyfile.properties"));
         System.setProperties(prop); 
    }

}
<context:property-placeholder ignore-resource-not-found="true" location="wmo-mule-app.properties,wmo-mule-app-unit-test.properties" />

在这种情况下,
wmo mule app.properties
是我的实际应用程序属性文件,而
wmo mule app unit test.properties
是过度单元测试属性文件。此单元测试属性文件将优先于wmo mule应用程序属性