Changeset 2500

Show
Ignore:
Timestamp:
10/06/08 16:22:45 (3 months ago)
Author:
dsanders
Message:

Modified so that war files are deployed and undeployed independent of starting up and shutting down glassfish.

Location:
trunk/otis/src/org/bandit/otis
Files:
6 added
4 removed
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/otis/src/org/bandit/otis/server/EntityHandler.java

    r2490 r2500  
    553553                try 
    554554                { 
     555                        m_log.debug( "Calling getEntitites"); 
    555556                        entityIter = localAuthSession.getEntities( null, (attrList != null) ? attrList.iterator() : null); 
     557                        m_log.debug( "Start iterating through results"); 
     558                        int     iAttrCnt = 0; 
    556559                        while (entityIter.hasNext()) 
    557560                        { 
     
    566569                                 
    567570                                List    entityAttrList; 
     571                                iAttrCnt++; 
     572                                m_log.debug( "Getting attr #" + iAttrCnt); 
    568573                                if ((entityAttrList = queryAttributes( strSessionID, "Entity='" + strEntityID + "'", entity, attrList, responseMap)) != null) 
    569574                                { 
    570575                                        entityMap.put( Constants.TEMPLATE_ATTR_LIST, entityAttrList); 
    571576                                } 
     577                                m_log.debug( "Got attr #" + iAttrCnt); 
    572578                                entityList.add( entityMap); 
    573579                        } 
     580                        m_log.debug( "Done iterating through results"); 
    574581                } 
    575582                catch (IdASException e) 
  • trunk/otis/src/org/bandit/otis/server/OtisServlet.java

    r2483 r2500  
    11631163                                StringWriter    strOut = new StringWriter( 1024); 
    11641164                                Template                        template = m_templateCfg.getTemplate( strTemplateFile); 
    1165                                  
     1165 
     1166                                m_log.debug( "Processing template " + strTemplateFile + " ....");                                
    11661167                                template.process( responseMap, strOut); 
     1168                                m_log.debug( "Done processing template " + strTemplateFile); 
    11671169                                 
    11681170                                // Now output over HTTP. 
  • trunk/otis/src/org/bandit/otis/test/OTISRunner.java

    r2499 r2500  
    2020        private static int port = 9997; 
    2121        private static Integer sync = new Integer( 0); 
     22         
     23        public static void startGlassfish() 
     24        { 
     25                try 
     26                { 
     27                        synchronized( sync) 
     28                        { 
     29                                glassfish = new AppServer(port); 
     30                        } 
     31                } 
     32                catch (Throwable e) 
     33                { 
     34                        System.out.println( e.getMessage()); 
     35                        e.printStackTrace(); 
     36                } 
     37        } 
     38         
     39        public static void stopGlassfish() 
     40        { 
     41                try 
     42                { 
     43                        synchronized( sync) 
     44                        { 
     45                                glassfish.stop(); 
     46                                glassfish = null; 
     47                        } 
     48                } 
     49                catch (Throwable e) 
     50                { 
     51                        System.out.println( e.getMessage()); 
     52                        e.printStackTrace(); 
     53                } 
     54        } 
    2255         
    2356        private static void copyFile( 
     
    89122        } 
    90123                 
    91         public static void start( 
     124        public static void deployWar( 
    92125                String  strServerConfigFile, 
    93126                String  strServerLocalConfigFile) throws IOException { 
     
    97130                        { 
    98131                                otisUseCount++; 
    99                                 System.out.println( "start, count = " + otisUseCount); 
    100                                 if (otisUseCount == 1) { 
    101                                         System.out.println( "Allocating glassfish"); 
    102                                         glassfish = new AppServer(port); 
     132                                if (otisUseCount == 1) 
     133                                { 
     134                                        if (glassfish == null) 
     135                                        { 
     136                                                glassfish = new AppServer(port); 
     137                                        } 
    103138                                        otis = glassfish.deploy(new File("build/otis-test.war")); 
    104139                                        byte [] copyBuf = new byte [2048]; 
    105                                         if (strServerConfigFile != null) { 
     140                                        if (strServerConfigFile != null) 
     141                                        { 
    106142                                          // Copy over otis-config.server.xml 
    107143                                          copyFile( "otis-config.server.xml", strServerConfigFile, copyBuf); 
    108144                                        } 
    109                                         if (strServerLocalConfigFile != null) { 
     145                                        if (strServerLocalConfigFile != null) 
     146                                        { 
    110147                                          // Copy over otis-config.client.local.xml 
    111148                                          copyFile( "otis-config.client.local.xml", strServerLocalConfigFile, copyBuf); 
     
    129166        } 
    130167         
    131         public static void stop() { 
     168        public static void undeployWar() 
     169        { 
    132170                try 
    133171                { 
     
    135173                        { 
    136174                                otisUseCount--; 
    137                                 System.out.println( "stop, count = " + otisUseCount); 
    138                                 if (otisUseCount == 0) { 
     175                                if (otisUseCount == 0) 
     176                                { 
    139177                                        otis.undeploy(); 
    140                                         glassfish.stop(); 
    141                                         glassfish = null; 
    142                                         System.out.println( "UNDEPLOY"); 
    143178                                } 
    144179                        } 
     
    150185                } 
    151186        } 
    152          
    153187} 
     188 
  • trunk/otis/src/org/bandit/otis/test/junit/AllTests.java

    r2499 r2500  
    1010        { 
    1111                TestSuite suite = new TestSuite("Test for org.bandit.otis.test"); 
     12                 
    1213                //$JUnit-BEGIN$ 
    13                 // OTISStartup - use around tests that don't have to manipulate server startup 
    14                 suite.addTestSuite(OTISStartup.class); 
     14                suite.addTestSuite(GlassfishStartup.class); 
     15                // Deploy the default OTIS war file for the following tests 
     16                suite.addTestSuite(DeployOTIS.class); 
    1517                suite.addTestSuite(UriBuilderTest.class); 
    1618                suite.addTestSuite(AttributeTest.class); 
     
    2123                suite.addTestSuite(PropertiesTest.class); 
    2224//              suite.addTestSuite(IDMSessionTest.class); 
    23                 // OTISShutdown will force OTIS server to go down 
    24                 suite.addTestSuite(OTISShutdown.class); 
     25                // Undeploy the default OTIS war file 
     26                suite.addTestSuite(UndeployOTIS.class); 
    2527                 
    26                 // These tests do their own thing with OTIS server - different config. 
    27 /*              Commented out for now because the startup/shutdown of the OTIS server has problems. 
    28                 suite.addTestSuite(OTISStartupAnd.class); 
     28                // These tests slightly modify the OTIS war configuration 
     29                suite.addTestSuite(DeployOTISAnd.class); 
    2930                suite.addTestSuite(CustomAuthMethodTestAnd.class); 
    30                 suite.addTestSuite(OTISShutdown.class); 
     31                suite.addTestSuite(UndeployOTIS.class); 
    3132                 
    32                 suite.addTestSuite(OTISStartupOr.class); 
     33                suite.addTestSuite(DeployOTISOr.class); 
    3334                suite.addTestSuite(CustomAuthMethodTestOr.class); 
    34                 suite.addTestSuite(OTISShutdown.class); 
    35 */ 
     35                suite.addTestSuite(UndeployOTIS.class); 
     36                 
     37                suite.addTestSuite(GlassfishShutdown.class); 
    3638                 
    3739                //$JUnit-END$ 
  • trunk/otis/src/org/bandit/otis/test/junit/AuthSessionBaseTest.java

    r2499 r2500  
    5555        { 
    5656                try { 
    57                         OTISRunner.start( strServerConfigFile, strLocalConfigFile); 
     57                        OTISRunner.deployWar( strServerConfigFile, strLocalConfigFile); 
    5858                } catch (IOException e) { 
    5959                        m_log.error(e); 
     
    8989        protected void tearDown() 
    9090        { 
    91                 OTISRunner.stop(); 
     91                OTISRunner.undeployWar(); 
    9292                // ldapServer.shutdownTool(); 
    9393                ldapServer ls = ldapSrv.getServer(); 
  • trunk/otis/src/org/bandit/otis/test/junit/SampleDeployment.java

    r2499 r2500  
    1616                super.setUp(); 
    1717 
    18                 OTISRunner.start( null, null); 
     18                OTISRunner.deployWar( null, null); 
    1919                 
    2020                String[] args = 
     
    3636        protected void tearDown() 
    3737        { 
    38                 OTISRunner.stop(); 
     38                OTISRunner.undeployWar(); 
    3939                // ldapServer.shutdownTool(); 
    4040                ldapServer ls = ldapSrv.getServer();