1 17 18 package org.apache.geronimo.itest.client; 19 20 import javax.naming.InitialContext ; 21 22 import junit.framework.TestCase; 23 24 public class JndiEnvEntryTest extends TestCase { 25 26 27 public void testLookupStringEntry() throws Exception { 28 InitialContext ctx = new InitialContext (); 29 assertNotNull("The InitialContext is null", ctx); 30 31 String expected = new String ("1"); 32 String actual = (String ) ctx.lookup("java:comp/env/entry/String"); 33 34 assertNotNull("The String looked up is null", actual); 35 assertEquals(expected, actual); 36 } 37 38 public void testLookupDoubleEntry() throws Exception { 39 InitialContext ctx = new InitialContext (); 40 assertNotNull("The InitialContext is null", ctx); 41 42 Double expected = new Double (1.0D); 43 Double actual = (Double ) ctx.lookup("java:comp/env/entry/Double"); 44 45 assertNotNull("The Double looked up is null", actual); 46 assertEquals(expected, actual); 47 } 48 49 public void testLookupLongEntry() throws Exception { 50 InitialContext ctx = new InitialContext (); 51 assertNotNull("The InitialContext is null", ctx); 52 53 Long expected = new Long (1L); 54 Long actual = (Long ) ctx.lookup("java:comp/env/entry/Long"); 55 56 assertNotNull("The Long looked up is null", actual); 57 assertEquals(expected, actual); 58 } 59 60 public void testLookupFloatEntry() throws Exception { 61 InitialContext ctx = new InitialContext (); 62 assertNotNull("The InitialContext is null", ctx); 63 64 Float expected = new Float (1.0F); 65 Float actual = (Float ) ctx.lookup("java:comp/env/entry/Float"); 66 67 assertNotNull("The Float looked up is null", actual); 68 assertEquals(expected, actual); 69 } 70 71 public void testLookupIntegerEntry() throws Exception { 72 InitialContext ctx = new InitialContext (); 73 assertNotNull("The InitialContext is null", ctx); 74 75 Integer expected = new Integer (1); 76 Integer actual = (Integer ) ctx.lookup("java:comp/env/entry/Integer"); 77 78 assertNotNull("The Integer looked up is null", actual); 79 assertEquals(expected, actual); 80 } 81 82 public void testLookupShortEntry() throws Exception { 83 InitialContext ctx = new InitialContext (); 84 assertNotNull("The InitialContext is null", ctx); 85 86 Short expected = new Short ((short) 1); 87 Short actual = (Short ) ctx.lookup("java:comp/env/entry/Short"); 88 89 assertNotNull("The Short looked up is null", actual); 90 assertEquals(expected, actual); 91 } 92 93 public void testLookupBooleanEntry() throws Exception { 94 InitialContext ctx = new InitialContext (); 95 assertNotNull("The InitialContext is null", ctx); 96 97 Boolean expected = new Boolean (true); 98 Boolean actual = (Boolean ) ctx.lookup("java:comp/env/entry/Boolean"); 99 100 assertNotNull("The Boolean looked up is null", actual); 101 assertEquals(expected, actual); 102 } 103 104 public void testLookupByteEntry() throws Exception { 105 InitialContext ctx = new InitialContext (); 106 assertNotNull("The InitialContext is null", ctx); 107 108 Byte expected = new Byte ((byte) 1); 109 Byte actual = (Byte ) ctx.lookup("java:comp/env/entry/Byte"); 110 111 assertNotNull("The Byte looked up is null", actual); 112 assertEquals(expected, actual); 113 } 114 115 } 116 | Popular Tags |