mam mrówki wykonujące słoik z następującego koduPrzechodząc właściwości systemowe Java do testów mrówek
<target name="start.my.jar" description="start my jar">
<echo message="Starting the jar" />
<java jar="${jars.dir}/${my.stub.jar}" fork="true" dir="${jars.dir}" spawn="true">
<sysproperty key="properties.filename" value="${basedir}/path/path/path/filename.properties"/>
<arg value="start" />
</java>
</target>
wewnątrz słoika istnieje klasa z następującego kodu
public static MyFacade createFacade() throws FileNotFoundException, IOException {
return createFacade(System.getProperty(properties.filename));
}
a potem jest mrówka Cel testu skonfigurowany jako ten
Moje testy w tym docelowym module testowym nie pozwalają uzyskać właściwości dla pliku i określonego w celu start.my.jar. Czy coś jest nie tak?
SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
[junit] java.lang.NullPointerException
[junit] at java.io.File.<init>(File.java:222)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.getInputStream(MyFacadeFactory.java:47)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.loadFacade(MyFacadeFactory.java:43)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.createFacade(MyFacadeFactory.java:32)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.createFacade(MyFacadeFactory.java:28)
[junit] at com.mycompany.myproduct.sdk.resources.impl.TransactionResourceImpl.<init>(TransactionResourceImpl.java:70)
[junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[junit] at com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:191)
spróbować powrócić createFacade (System.getProperty ("properties.filename")); – user1097489
Popełniłem błąd, że jest to właściwość. Nazwa pliku, ale nadal nie działa – ThaSaleni
czy mógłbyś opublikować stacktrace? – user1097489