@Override public void beforeReceive(MessageSource<?> source) { if (this.fair || !this.initialized) { configureSource(source); this.initialized = true; } if (this.logger.isTraceEnabled()) { this.logger.trace("Next poll is for " + this.current); } this.factory.setThreadKey(this.current.getKey()); }
@Test public void testDelegates() { assertEquals(foo.mockSession, this.dsf.getSession("foo")); assertEquals(bar.mockSession, this.dsf.getSession("bar")); assertEquals(bar.mockSession, this.dsf.getSession("junk")); assertEquals(bar.mockSession, this.dsf.getSession()); this.dsf.setThreadKey("foo"); assertEquals(foo.mockSession, this.dsf.getSession("foo")); this.dsf.clearThreadKey(); TestSessionFactory factory = new TestSessionFactory(); this.sessionFactoryLocator.addSessionFactory("baz", factory); this.dsf.setThreadKey("baz"); assertEquals(factory.mockSession, this.dsf.getSession("baz")); this.dsf.clearThreadKey(); assertSame(factory, sessionFactoryLocator.removeSessionFactory("baz")); }