}
@Test
public void verifyRuleAgentPkgFile() throws Exception
{
KnowledgePackage kpkg;
File file = null;
OutputStream os = null;
try
{
Class<?> clazz = getClass();
file = File.createTempFile(clazz.getSimpleName() + "-", ".properties");
Properties properties = new Properties();
properties.setProperty(RuleAgent.URLS, clazz.getResource("/testrules.pkg").toString());
os = new FileOutputStream(file);
properties.store(os, clazz.getSimpleName());
RuleInfo ruleInfo = new RuleInfoBuilder(file.getAbsolutePath()).build();
KnowledgeAgent ka = helper.createRuleAgent(ruleInfo);
kpkg = ka.getKnowledgeBase().getKnowledgePackage("org.jboss.internal.soa.esb.rules");
}
finally
{
try { if (os != null) os.close(); } catch (Throwable t) {}
try { if (file != null) file.delete(); } catch (Throwable t) {}
}
assertNotNull(kpkg);
assertEquals("org.jboss.internal.soa.esb.rules", kpkg.getName());
}