Package org.jboss.test.securitymgr.interfaces

Examples of org.jboss.test.securitymgr.interfaces.IOSession


   }

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


   }

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

   }

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

   }

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

   private IOSession getIOSession() throws Exception
   {
      Object obj = getInitialContext().lookup("secmgr.IOSessionHome");
      IOSessionHome home = (IOSessionHome) obj;
      log.debug("Found secmgr.IOSessionHome");
      IOSession bean = home.create();
      log.debug("Created IOSession");
      return bean;
   }
View Full Code Here

   /** Test that a bean cannot access the filesystem using java.io.File
    */
   public void testFileExists() throws Exception
   {
      log.debug("+++ testFileExists()");
      IOSession 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);
View Full Code Here

   /** Test that a bean cannot access the filesystem using java.io.File
    */
   public void testFileWrite() throws Exception
   {
      log.debug("+++ testFileWrite()");
      IOSession bean = getIOSession();
      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);
      }
      bean.remove();
   }
View Full Code Here

   }

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

   }

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

   }

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

TOP

Related Classes of org.jboss.test.securitymgr.interfaces.IOSession

Copyright © 2018 www.massapicom. 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.