View Javadoc
1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package org.itracker.services.util;
6   
7   import org.itracker.AbstractDependencyInjectionTest;
8   import org.junit.Test;
9   
10  import javax.naming.InitialContext;
11  import javax.naming.NamingException;
12  import java.util.Hashtable;
13  
14  // TODO: Add Javadocs here: what is the purpose of this class?
15  
16  /**
17   * @author seas
18   */
19  public class NamingUtilitiesIT extends AbstractDependencyInjectionTest {
20  
21      @Test
22      public void testGetStringValue() {
23          final Hashtable<String, String> hashtable = new Hashtable<String, String>();
24          hashtable.put("key", "value");
25          try {
26              final InitialContext context = new InitialContext(hashtable);
27              final String value = NamingUtilites.getStringValue(context, "key", "value");
28              assertEquals("value", value);
29          } catch (final NamingException e) {
30              assertTrue(e.getMessage(), false);
31          }
32      }
33  
34      /**
35       * Defines a set of datafiles to be uploaded into database.
36       *
37       * @return an array with datafiles.
38       */
39      protected String[] getDataSetFiles() {
40          return new String[]{
41                  "dataset/languagebean_dataset.xml"
42          };
43      }
44  
45      /**
46       * Defines a simple configuration, required for running tests.
47       *
48       * @return an array of references to configuration files.
49       */
50      protected String[] getConfigLocations() {
51          return new String[]{"application-context.xml"};
52      }
53  }