View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  
18  package ch.elca.el4j.tests.remoting.jaxws.service;
19  
20  import java.util.HashMap;
21  import java.util.Map;
22  
23  import org.slf4j.Logger;
24  import org.slf4j.LoggerFactory;
25  import org.springframework.util.Assert;
26  
27  import ch.elca.el4j.core.contextpassing.ImplicitContextPasser;
28  import ch.elca.el4j.core.contextpassing.ImplicitContextPassingRegistry;
29  
30  /**
31   * This class is used to test if the implicit context passing works.
32   *
33   * @svnLink $Revision: 3884 $;$Date: 2009-08-04 15:48:31 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/tests/remoting_jaxws/jar-wsgen/src/main/java/ch/elca/el4j/tests/remoting/jaxws/service/TestImplicitContextPassingRegistry.java $
34   *
35   * @author Martin Zeltner (MZE)
36   */
37  public class TestImplicitContextPassingRegistry implements
38  		ImplicitContextPassingRegistry {
39  	
40  	/**
41  	 * The test message.
42  	 */
43  	private static final String MESSAGE = "Hello everybody, I am THE test message.";
44  	
45  	/**
46  	 * Private logger.
47  	 */
48  	private static Logger s_logger = LoggerFactory.getLogger(
49  		TestImplicitContextPassingRegistry.class);
50  
51  	/**
52  	 * {@inheritDoc}
53  	 */
54  	public void registerImplicitContextPasser(
55  		ImplicitContextPasser passer) {
56  		// Do nothing.
57  	}
58  
59  	/**
60  	 * {@inheritDoc}
61  	 */
62  	public void unregisterImplicitContextPasser(
63  		ImplicitContextPasser passer) {
64  		// Do nothing.
65  	}
66  	
67  	/**
68  	 * {@inheritDoc}
69  	 */
70  	@SuppressWarnings("unchecked")
71  	public Map getAssembledImplicitContext() {
72  		Map map = new HashMap();
73  		map.put("testMessage", MESSAGE);
74  		return map;
75  	}
76  
77  	/**
78  	 * {@inheritDoc}
79  	 */
80  	@SuppressWarnings("unchecked")
81  	public void pushAssembledImplicitContext(Map contexts) {
82  		s_logger.info("Test message: " + contexts.get("testMessage"));
83  		Assert.isTrue(MESSAGE.equals(contexts.get("testMessage")));
84  	}
85  }