Examples of IOStatelessSessionBean


Examples of org.jboss.test.securitymgr.ejb.IOStatelessSessionBean

   /** Test that a bean cannot access the filesystem using java.io.File
    */
   public void testFileIO() throws Exception
   {
      log.debug("+++ testFileIO()");
      IOStatelessSessionBean bean = getIOSession();

      try
      {
         // This should fail because the bean calls File.exists()
         bean.read("nofile.txt");
         doFail("Was able to call IOSession.read");
      }
      catch(Exception e)
      {
         log.debug("IOSession.read failed as expected", e);
      }

      try
      {
         // This should fail because the bean calls File.exists()
         bean.write("nofile.txt");
         doFail("Was able to call IOSession.write");
      }
      catch(Exception e)
      {
         log.debug("IOSession.write failed as expected", e);
View Full Code Here

Examples of org.jboss.test.securitymgr.ejb.IOStatelessSessionBean

   }

   public void testSockets() throws Exception
   {
      log.debug("+++ testSockets()");
      IOStatelessSessionBean bean = getIOSession();
      try
      {
         bean.listen(0);
         doFail("Was able to call IOSession.listen");
      }
      catch(Exception e)
      {
         log.debug("IOSession.listen failed as expected", e);
      }

      final ServerSocket tmp = new ServerSocket(0);
      log.debug("Created ServerSocket: "+tmp);
      final Logger theLog = log;
      Thread t = new Thread("Acceptor")
      {
         public void run()
         {
            try
            {
               Socket s = tmp.accept();
               theLog.debug("Accepted Socket: "+s);
               s.close();
               theLog.debug("ServerSocket thread exiting");
            }
            catch(IOException e)
            {
            }
         }
      };
      int port = tmp.getLocalPort();
      t.start();
      bean.connect("localhost", port);
      tmp.close();
   }
View Full Code Here

Examples of org.jboss.test.securitymgr.ejb.IOStatelessSessionBean

   }

   public void testClassLoaders() throws Exception
   {
      log.debug("+++ testClassLoaders()");
      IOStatelessSessionBean bean = getIOSession();
      try
      {
         bean.createClassLoader();
         doFail("Was able to call IOSession.createClassLoader");
      }
      catch(Exception e)
      {
         log.debug("IOSession.createClassLoader failed as expected", e);
      }

      try
      {
         bean.getContextClassLoader();
         //doFail("Was able to call IOSession.getContextClassLoader");
         log.debug("Was able to call IOSession.getContextClassLoader");
      }
      catch(Exception e)
      {
         log.debug("IOSession.getContextClassLoader failed as expected", e);
      }

      try
      {
         bean.setContextClassLoader();
         doFail("Was able to call IOSession.setContextClassLoader");
      }
      catch(Exception e)
      {
         log.debug("IOSession.setContextClassLoader failed as expected", e);
View Full Code Here

Examples of org.jboss.test.securitymgr.ejb.IOStatelessSessionBean

   }

   public void testReflection() throws Exception
   {
      log.debug("+++ testReflection()");
      IOStatelessSessionBean bean = getIOSession();
      try
      {
         bean.useReflection();
         doFail("Was able to call IOSession.useReflection");
      }
      catch(Exception e)
      {
         log.debug("IOSession.useReflection failed as expected", e);
View Full Code Here

Examples of org.jboss.test.securitymgr.ejb.IOStatelessSessionBean

   }

   public void testThreadAccess() throws Exception
   {
      log.debug("+++ testThreadAccess()");
      IOStatelessSessionBean bean = getIOSession();
      try
      {
         // This test will fail because the calling thread it not in the root thread group
         bean.renameThread();
         doFail("Was able to call IOSession.renameThread");
      }
      catch(Exception e)
      {
         log.debug("IOSession.renameThread failed as expected", e);
View Full Code Here

Examples of org.jboss.test.securitymgr.ejb.IOStatelessSessionBean

   }

   public void testSystemAccess() throws Exception
   {
      log.debug("+++ testSystemAccess()");
      IOStatelessSessionBean bean = getIOSession();
      try
      {
         bean.createSecurityMgr();
         doFail("Was able to call IOSession.createSecurityMgr");
      }
      catch(Exception e)
      {
         log.debug("IOSession.createSecurityMgr failed as expected", e);
      }

      try
      {
         bean.createSecurityMgr();
         doFail("Was able to call IOSession.changeSystemOut");
      }
      catch(Exception e)
      {
         log.debug("IOSession.changeSystemOut failed as expected", e);
      }

      try
      {
         bean.changeSystemErr();
         doFail("Was able to call IOSession.changeSystemErr");
      }
      catch(Exception e)
      {
         log.debug("IOSession.changeSystemErr failed as expected", e);
      }

      try
      {
         bean.loadLibrary();
         doFail("Was able to call IOSession.loadLibrary");
      }
      catch(Exception e)
      {
         log.debug("IOSession.loadLibrary failed as expected", e);
View Full Code Here

Examples of org.jboss.test.securitymgr.ejb.IOStatelessSessionBean

      BadBean bean = new BadBean();
      return bean;
   }
   private IOStatelessSessionBean getIOSession()
   {
      IOStatelessSessionBean bean = new IOStatelessSessionBean();
      return bean;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.