use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class GenericPackagerTest method testSetConfigurationThrowsConfigurationException.
@Ignore("test failing")
@Test
public void testSetConfigurationThrowsConfigurationException() throws Throwable {
GenericPackager genericPackager = new GenericPackager();
Configuration cfg = new SimpleConfiguration();
try {
genericPackager.setConfiguration(cfg);
fail("Expected ConfigurationException to be thrown");
} catch (ConfigurationException ex) {
assertEquals("ex.getMessage()", "org.jpos.iso.ISOException: java.lang.ClassNotFoundException: org.apache.crimson.parser.XMLReaderImpl (java.lang.ClassNotFoundException: org.apache.crimson.parser.XMLReaderImpl)", ex.getMessage());
assertEquals("ex.getNested().getMessage()", "java.lang.ClassNotFoundException: org.apache.crimson.parser.XMLReaderImpl", ex.getNested().getMessage());
assertEquals("(GenericValidatingPackager) genericValidatingPackager.getLogger().getName()", "", genericPackager.getLogger().getName());
assertEquals("(GenericValidatingPackager) genericValidatingPackager.getRealm()", "", genericPackager.getRealm());
}
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class TransactionManager method initService.
@Override
public void initService() throws ConfigurationException {
queue = cfg.get("queue", null);
if (queue == null)
throw new ConfigurationException("queue property not specified");
sp = SpaceFactory.getSpace(cfg.get("space"));
isp = SpaceFactory.getSpace(cfg.get("input-space", cfg.get("space")));
if (isp == sp)
iisp = isp;
else {
iisp = sp;
}
psp = SpaceFactory.getSpace(cfg.get("persistent-space", this.toString()));
tail = initCounter(TAIL, cfg.getLong("initial-tail", 1));
head = Math.max(initCounter(HEAD, tail), tail);
initTailLock();
groups = new HashMap<>();
initParticipants(getPersist());
initStatusListeners(getPersist());
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class BSHTransactionParticipant method setConfiguration.
public void setConfiguration(Element e) throws ConfigurationException {
try {
prepareMethod = BSHMethod.createBshMethod(e.getChild("prepare"));
prepareForAbortMethod = BSHMethod.createBshMethod(e.getChild("prepare-for-abort"));
commitMethod = BSHMethod.createBshMethod(e.getChild("commit"));
abortMethod = BSHMethod.createBshMethod(e.getChild("abort"));
trace = "yes".equals(e.getAttributeValue("trace"));
} catch (Exception ex) {
throw new ConfigurationException(ex.getMessage(), ex);
}
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class Forward method setConfiguration.
public void setConfiguration(Configuration cfg) throws ConfigurationException {
sp = SpaceFactory.getSpace(cfg.get("space", ""));
queue = cfg.get("queue", null);
if (queue == null)
throw new ConfigurationException("Unspecified queue");
timeout = cfg.getLong("timeout", 60000L);
}
use of org.jpos.core.ConfigurationException in project jPOS by jpos.
the class JSParticipant method setConfiguration.
public void setConfiguration(Element e) throws ConfigurationException {
try (FileReader src = new FileReader(e.getAttributeValue("src"))) {
trace = "yes".equals(e.getAttributeValue("trace"));
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
engine.eval(src);
js = (Invocable) engine;
hasPrepare = hasFunction("prepare");
hasPrepareForAbort = hasFunction("prepareForAbort");
hasCommit = hasFunction("commit");
hasAbort = hasFunction("abort");
} catch (Exception ex) {
throw new ConfigurationException(ex.getMessage(), ex);
}
}
Aggregations