@Test public void testInitServiceWithoutListeners() throws Throwable { QMUX mux = new QMUX(); Configuration cfg = new SimpleConfiguration(); mux.setConfiguration(cfg); Element persist = new Element("testQMUXName"); persist.addContent(new Element("in").addContent("queue-in")); persist.addContent(new Element("out").addContent("queue-out")); persist.addContent(new Element("unhandled").addContent("queue-unhandled")); persist.addContent(new Element("ready").addContent("test-ready")); persist.addContent(new Element("unhandled").addContent("queue-unhandled")); mux.setPersist(persist); mux.initService(); assertEquals("queue-unhandled", mux.unhandled); assertEquals("queue-out", mux.out); assertEquals("queue-in", mux.in); assertNull(mux.ignorerc); assertNotNull(mux.sp); assertFalse(mux.isModified()); assertArrayEquals(new String[]{"test-ready"}, mux.ready); assertArrayEquals(new String[]{"41", "11"}, mux.key); assertEquals(0, mux.listeners.size()); }
public void initService () throws ConfigurationException { Element e = getPersist (); sp = grabSpace (e.getChild ("space")); isp = cfg.getBoolean("reuse-space", false) ? sp : new TSpace(); in = Environment.get(e.getChildTextTrim ("in")); out = Environment.get(e.getChildTextTrim ("out")); if (in == null || out == null) { throw new ConfigurationException ("Misconfigured QMUX. Please verify in/out queues"); } ignorerc = Environment.get(e.getChildTextTrim ("ignore-rc")); key = toStringArray(DEFAULT_KEY, ", ", null); returnRejects = cfg.getBoolean("return-rejects", false); for (Element keyElement : e.getChildren("key")) { String mtiOverride = QFactory.getAttributeValue(keyElement, "mti"); if (mtiOverride != null && mtiOverride.length() >= 2) { mtiKey.put (mtiOverride.substring(0,2), toStringArray(keyElement.getTextTrim(), ", ", null)); } else { key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY); } } ready = toStringArray(Environment.get(e.getChildTextTrim ("ready"))); mtiMapping = toStringArray(Environment.get(e.getChildTextTrim ("mtimapping"))); if (mtiMapping == null || mtiMapping.length != 3) mtiMapping = new String[] { nomap, nomap, "0022446689" }; addListeners (); unhandled = Environment.get(e.getChildTextTrim ("unhandled")); NameRegistrar.register ("mux."+getName (), this); }
QMUX extends QBeanSupport implements SpaceListener, MUX, QMUXMBean, Loggeable, MetricsProvider { public void initService () throws ConfigurationException { Element e = getPersist (); sp = grabSpace (e.getChild ("space")); isp = cfg.getBoolean("reuse-space", false) ? sp : new TSpace(); in = Environment.get(e.getChildTextTrim ("in")); out = Environment.get(e.getChildTextTrim ("out")); if (in == null || out == null) { throw new ConfigurationException ("Misconfigured QMUX. Please verify in/out queues"); } ignorerc = Environment.get(e.getChildTextTrim ("ignore-rc")); key = toStringArray(DEFAULT_KEY, ", ", null); returnRejects = cfg.getBoolean("return-rejects", false); for (Element keyElement : e.getChildren("key")) { String mtiOverride = QFactory.getAttributeValue(keyElement, "mti"); if (mtiOverride != null && mtiOverride.length() >= 2) { mtiKey.put (mtiOverride.substring(0,2), toStringArray(keyElement.getTextTrim(), ", ", null)); } else { key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY); } } ready = toStringArray(Environment.get(e.getChildTextTrim ("ready"))); mtiMapping = toStringArray(Environment.get(e.getChildTextTrim ("mtimapping"))); if (mtiMapping == null || mtiMapping.length != 3) mtiMapping = new String[] { nomap, nomap, "0022446689" }; addListeners (); unhandled = Environment.get(e.getChildTextTrim ("unhandled")); NameRegistrar.register ("mux."+getName (), this); } }
QMUX extends QBeanSupport implements SpaceListener, MUX, QMUXMBean, Loggeable, MetricsProvider { public void initService () throws ConfigurationException { Element e = getPersist (); sp = grabSpace (e.getChild ("space")); isp = cfg.getBoolean("reuse-space", false) ? sp : new TSpace(); in = Environment.get(e.getChildTextTrim ("in")); out = Environment.get(e.getChildTextTrim ("out")); if (in == null || out == null) { throw new ConfigurationException ("Misconfigured QMUX. Please verify in/out queues"); } ignorerc = Environment.get(e.getChildTextTrim ("ignore-rc")); key = toStringArray(DEFAULT_KEY, ", ", null); returnRejects = cfg.getBoolean("return-rejects", false); for (Element keyElement : e.getChildren("key")) { String mtiOverride = QFactory.getAttributeValue(keyElement, "mti"); if (mtiOverride != null && mtiOverride.length() >= 2) { mtiKey.put (mtiOverride.substring(0,2), toStringArray(keyElement.getTextTrim(), ", ", null)); } else { key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY); } } ready = toStringArray(Environment.get(e.getChildTextTrim ("ready"))); mtiMapping = toStringArray(Environment.get(e.getChildTextTrim ("mtimapping"))); if (mtiMapping == null || mtiMapping.length != 3) mtiMapping = new String[] { nomap, nomap, "0022446689" }; addListeners (); unhandled = Environment.get(e.getChildTextTrim ("unhandled")); NameRegistrar.register ("mux."+getName (), this); } QMUX(); }
QMUX extends QBeanSupport implements SpaceListener, MUX, QMUXMBean, Loggeable, MetricsProvider { public void initService () throws ConfigurationException { Element e = getPersist (); sp = grabSpace (e.getChild ("space")); isp = cfg.getBoolean("reuse-space", false) ? sp : new TSpace(); in = Environment.get(e.getChildTextTrim ("in")); out = Environment.get(e.getChildTextTrim ("out")); if (in == null || out == null) { throw new ConfigurationException ("Misconfigured QMUX. Please verify in/out queues"); } ignorerc = Environment.get(e.getChildTextTrim ("ignore-rc")); key = toStringArray(DEFAULT_KEY, ", ", null); returnRejects = cfg.getBoolean("return-rejects", false); for (Element keyElement : e.getChildren("key")) { String mtiOverride = QFactory.getAttributeValue(keyElement, "mti"); if (mtiOverride != null && mtiOverride.length() >= 2) { mtiKey.put (mtiOverride.substring(0,2), toStringArray(keyElement.getTextTrim(), ", ", null)); } else { key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY); } } ready = toStringArray(Environment.get(e.getChildTextTrim ("ready"))); mtiMapping = toStringArray(Environment.get(e.getChildTextTrim ("mtimapping"))); if (mtiMapping == null || mtiMapping.length != 3) mtiMapping = new String[] { nomap, nomap, "0022446689" }; addListeners (); unhandled = Environment.get(e.getChildTextTrim ("unhandled")); NameRegistrar.register ("mux."+getName (), this); } QMUX(); void initService(); void startService(); void stopService(); void destroyService(); static MUX getMUX(String name); ISOMsg request(ISOMsg m, long timeout); void request(ISOMsg m, long timeout, ISOResponseListener rl, Object handBack); @Override void notify(Object k, Object value); String getKey(ISOMsg m); @Override Metrics getMetrics(); synchronized void setInQueue(String in); String getInQueue(); synchronized void setOutQueue(String out); String getOutQueue(); Space getSpace(); synchronized void setUnhandledQueue(String unhandled); String getUnhandledQueue(); @SuppressWarnings("unused") String[] getReadyIndicatorNames(); void addISORequestListener(ISORequestListener l); boolean removeISORequestListener(ISORequestListener l); synchronized void resetCounters(); String getCountersAsString(); int getTXCounter(); int getRXCounter(); @Override int getTXExpired(); @Override int getTXPending(); @Override int getRXExpired(); @Override int getRXPending(); @Override int getRXUnhandled(); @Override int getRXForwarded(); long getLastTxnTimestampInMillis(); long getIdleTimeInMillis(); void send(ISOMsg m); boolean isConnected(); void dump(PrintStream p, String indent); }
QMUX extends QBeanSupport implements SpaceListener, MUX, QMUXMBean, Loggeable, MetricsProvider { public void initService () throws ConfigurationException { Element e = getPersist (); sp = grabSpace (e.getChild ("space")); isp = cfg.getBoolean("reuse-space", false) ? sp : new TSpace(); in = Environment.get(e.getChildTextTrim ("in")); out = Environment.get(e.getChildTextTrim ("out")); if (in == null || out == null) { throw new ConfigurationException ("Misconfigured QMUX. Please verify in/out queues"); } ignorerc = Environment.get(e.getChildTextTrim ("ignore-rc")); key = toStringArray(DEFAULT_KEY, ", ", null); returnRejects = cfg.getBoolean("return-rejects", false); for (Element keyElement : e.getChildren("key")) { String mtiOverride = QFactory.getAttributeValue(keyElement, "mti"); if (mtiOverride != null && mtiOverride.length() >= 2) { mtiKey.put (mtiOverride.substring(0,2), toStringArray(keyElement.getTextTrim(), ", ", null)); } else { key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY); } } ready = toStringArray(Environment.get(e.getChildTextTrim ("ready"))); mtiMapping = toStringArray(Environment.get(e.getChildTextTrim ("mtimapping"))); if (mtiMapping == null || mtiMapping.length != 3) mtiMapping = new String[] { nomap, nomap, "0022446689" }; addListeners (); unhandled = Environment.get(e.getChildTextTrim ("unhandled")); NameRegistrar.register ("mux."+getName (), this); } QMUX(); void initService(); void startService(); void stopService(); void destroyService(); static MUX getMUX(String name); ISOMsg request(ISOMsg m, long timeout); void request(ISOMsg m, long timeout, ISOResponseListener rl, Object handBack); @Override void notify(Object k, Object value); String getKey(ISOMsg m); @Override Metrics getMetrics(); synchronized void setInQueue(String in); String getInQueue(); synchronized void setOutQueue(String out); String getOutQueue(); Space getSpace(); synchronized void setUnhandledQueue(String unhandled); String getUnhandledQueue(); @SuppressWarnings("unused") String[] getReadyIndicatorNames(); void addISORequestListener(ISORequestListener l); boolean removeISORequestListener(ISORequestListener l); synchronized void resetCounters(); String getCountersAsString(); int getTXCounter(); int getRXCounter(); @Override int getTXExpired(); @Override int getTXPending(); @Override int getRXExpired(); @Override int getRXPending(); @Override int getRXUnhandled(); @Override int getRXForwarded(); long getLastTxnTimestampInMillis(); long getIdleTimeInMillis(); void send(ISOMsg m); boolean isConnected(); void dump(PrintStream p, String indent);  }