1 22 package org.jboss.ejb3.test.naming.unit; 23 24 import org.jboss.ejb3.test.naming.TestENC; 25 import org.jboss.security.SecurityAssociation; 26 import org.jboss.security.SimplePrincipal; 27 import org.jboss.test.JBossTestCase; 28 import junit.framework.Test; 29 30 37 public class ENCUnitTestCase extends JBossTestCase 38 { 39 44 public ENCUnitTestCase(String name) 45 { 46 super(name); 47 } 48 49 53 public void testENC() throws Exception 54 { 55 SecurityAssociation.setPrincipal(new SimplePrincipal("jduke")); 56 SecurityAssociation.setCredential("theduke".toCharArray()); 57 58 TestENC bean = (TestENC)getInitialContext().lookup("ENCBean"); 59 getLog().debug("Created ENCBean"); 60 bean.accessENC(); 61 bean.remove(); 62 } 63 64 69 public void testENC2() throws Exception 70 { 71 SecurityAssociation.setPrincipal(new SimplePrincipal("jduke")); 72 SecurityAssociation.setCredential("theduke".toCharArray()); 73 74 TestENC bean = (TestENC)getInitialContext().lookup("ENCBean0"); 75 getLog().debug("Created ENCBean0"); 76 bean.accessENC(); 77 bean.remove(); 78 } 79 80 public static Test suite() throws Exception 81 { 82 return getDeploySetup(ENCUnitTestCase.class, "naming.jar"); 83 } 84 85 } 86 | Popular Tags |