]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
Dimension service tests now passing again.
authorRichard Millet <remillet@berkeley.edu>
Mon, 9 Apr 2012 15:18:33 +0000 (08:18 -0700)
committerRichard Millet <remillet@berkeley.edu>
Mon, 9 Apr 2012 15:18:33 +0000 (08:18 -0700)
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java
services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceServiceContextListener.java
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java
services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationCommon.java

index d5f022be5eb95fcf18e2dcd29240236ea0caae4a..1a84953fb0fb3cecdf0184f206c5229bc28a037e 100644 (file)
@@ -5,22 +5,25 @@ import javax.servlet.ServletContextEvent;
 import org.jboss.resteasy.core.Dispatcher;\r
 import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;\r
 import org.collectionspace.services.common.ResourceMap;\r
-import org.collectionspace.services.common.ServiceMain;\r
 \r
 public class CSpaceResteasyBootstrap extends ResteasyBootstrap {\r
        \r
-       public void  contextInitialized(ServletContextEvent event) {                            \r
-               //\r
-       // This call to super instantiates and initializes our JAX-RS application class.\r
-       // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.\r
-       //\r
-       System.out.println("[INFO] Starting up the CollectionSpace Services' JAX-RS application.");\r
-               super.contextInitialized(event);\r
-               CollectionSpaceJaxRsApplication app = \r
-                       (CollectionSpaceJaxRsApplication)deployment.getApplication();\r
-               Dispatcher disp = deployment.getDispatcher();\r
-               disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());\r
-               System.out.println("[INFO] CollectionSpace Services' JAX-RS application started.");\r
+       public void  contextInitialized(ServletContextEvent event) {\r
+               try {\r
+                       //\r
+               // This call to super instantiates and initializes our JAX-RS application class.\r
+               // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.\r
+               //\r
+               System.out.println("[INFO] Starting up the CollectionSpace Services' JAX-RS application.");\r
+                       super.contextInitialized(event);\r
+                       CollectionSpaceJaxRsApplication app = \r
+                               (CollectionSpaceJaxRsApplication)deployment.getApplication();\r
+                       Dispatcher disp = deployment.getDispatcher();\r
+                       disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());\r
+                       System.out.println("[INFO] CollectionSpace Services' JAX-RS application started.");\r
+               } catch (Throwable e) {\r
+                       e.printStackTrace();\r
+               }\r
        }\r
        \r
     @Override\r
index b2ae6814c4175b70c1ea03bb4ae7ff2962c77aa2..f7c0c251e95447413995ee4263a1aeeb7c860044 100644 (file)
@@ -21,14 +21,63 @@ public class CollectionSpaceServiceContextListener implements ServletContextList
                //
                ServletContext servletContext = event.getServletContext();
             ServiceMain svcMain = ServiceMain.getInstance(servletContext);
+            
+               {
+                       System.out.print("About to retrieveAllWorkspaceIds - Pausing 4:5 seconds for you to attached the debugger");
+                       long startTime, currentTime;
+                       currentTime = startTime = System.currentTimeMillis();
+                       long stopTime = startTime + 5 * 1000; //5 seconds
+                       do {
+                               if (currentTime % 1000 == 0) {
+                                       System.out.print(".");
+                               }
+                               currentTime = System.currentTimeMillis();
+                       } while (currentTime < stopTime);
+                               
+                       System.out.println();
+                       System.out.println("Resuming cspace services initialization.");
+               }
+            
             svcMain.retrieveAllWorkspaceIds();
 
+               {
+                       System.out.print("About to firePostInitHandlers - Pausing 5:5 seconds for you to attached the debugger");
+                       long startTime, currentTime;
+                       currentTime = startTime = System.currentTimeMillis();
+                       long stopTime = startTime + 5 * 1000; //5 seconds
+                       do {
+                               if (currentTime % 1000 == 0) {
+                                       System.out.print(".");
+                               }
+                               currentTime = System.currentTimeMillis();
+                       } while (currentTime < stopTime);
+                               
+                       System.out.println();
+                       System.out.println("Resuming cspace services initialization.");
+               }
+            
                //
                // Invoke all post-initialization handlers, passing in a DataSource instance of the Nuxeo db.
                // Typically, these handlers modify column types and add indexes to the Nuxeo db schema.
                //
                svcMain.firePostInitHandlers();
             
+               {
+                       System.out.print("Finished to firePostInitHandlers - Pausing 6:5 seconds for you to attached the debugger");
+                       long startTime, currentTime;
+                       currentTime = startTime = System.currentTimeMillis();
+                       long stopTime = startTime + 5 * 1000; //5 seconds
+                       do {
+                               if (currentTime % 1000 == 0) {
+                                       System.out.print(".");
+                               }
+                               currentTime = System.currentTimeMillis();
+                       } while (currentTime < stopTime);
+                               
+                       System.out.println();
+                       System.out.println("Resuming cspace services initialization.");
+               }
+               
         } catch (Exception e) {
             e.printStackTrace();
             //fail here
@@ -39,6 +88,6 @@ public class CollectionSpaceServiceContextListener implements ServletContextList
 
     @Override
     public void contextDestroyed(ServletContextEvent event) {
-        ServiceMain.getInstance().release();
+        //ServiceMain.getInstance().release();
     }
 }
index 0bf0add2d60c007f1fd6d653fe48b281475c2e05..2634d46ab45286f2e31f9112d3b7416c556b7163 100644 (file)
@@ -101,6 +101,23 @@ public class ServiceMain {
                     try {\r
                        //assume the worse\r
                        initFailed = true;\r
+                       \r
+                       {\r
+                               System.out.print("About to init ServiceMain - Pausing 3:5 seconds for you to attached the debugger");\r
+                               long startTime, currentTime;\r
+                               currentTime = startTime = System.currentTimeMillis();\r
+                               long stopTime = startTime + 5 * 1000; //5 seconds\r
+                               do {\r
+                                       if (currentTime % 1000 == 0) {\r
+                                               System.out.print(".");\r
+                                       }\r
+                                       currentTime = System.currentTimeMillis();\r
+                               } while (currentTime < stopTime);\r
+                                       \r
+                               System.out.println();\r
+                               System.out.println("Resuming cspace services initialization.");\r
+                       }\r
+                       \r
                         temp.initialize();\r
                        //celebrate success\r
                         initFailed = false;\r
@@ -125,21 +142,6 @@ public class ServiceMain {
     }\r
 \r
     private void initialize() throws Exception {\r
-       if (logger.isTraceEnabled() == true) {\r
-               System.out.print("Pausing 5 seconds for you to attached the debugger");\r
-               long startTime, currentTime;\r
-               currentTime = startTime = System.currentTimeMillis();\r
-               long stopTime = startTime + 5 * 1000; //5 seconds\r
-               do {\r
-                       if (currentTime % 1000 == 0) {\r
-                               System.out.print(".");\r
-                       }\r
-                       currentTime = System.currentTimeMillis();\r
-               } while (currentTime < stopTime);\r
-                       \r
-               System.out.println();\r
-               System.out.println("Resuming cspace services initialization.");\r
-       }\r
        \r
        setDataSources();\r
        setServerRootDir();\r
@@ -150,10 +152,45 @@ public class ServiceMain {
         //\r
         try {\r
                AuthorizationCommon.createDefaultPermissions(tenantBindingConfigReader);\r
+        \r
+               if (logger.isDebugEnabled() == true) {\r
+                       System.out.print("Pausing 1:5 seconds for you to attached the debugger");\r
+                       long startTime, currentTime;\r
+                       currentTime = startTime = System.currentTimeMillis();\r
+                       long stopTime = startTime + 5 * 1000; //5 seconds\r
+                       do {\r
+                               if (currentTime % 1000 == 0) {\r
+                                       System.out.print(".");\r
+                               }\r
+                               currentTime = System.currentTimeMillis();\r
+                       } while (currentTime < stopTime);\r
+                               \r
+                       System.out.println();\r
+                       System.out.println("Resuming cspace services initialization.");\r
+               }\r
+\r
                AuthorizationCommon.createDefaultAccounts(tenantBindingConfigReader);\r
+        \r
         } catch(Exception e) {\r
                logger.error("Default accounts setup failed with exception(s): " + e.getLocalizedMessage());\r
         }\r
+        \r
+       if (logger.isDebugEnabled() == true) {\r
+               System.out.print("Pausing 2:5 seconds for you to attached the debugger");\r
+               long startTime, currentTime;\r
+               currentTime = startTime = System.currentTimeMillis();\r
+               long stopTime = startTime + 5 * 1000; //5 seconds\r
+               do {\r
+                       if (currentTime % 1000 == 0) {\r
+                               System.out.print(".");\r
+                       }\r
+                       currentTime = System.currentTimeMillis();\r
+               } while (currentTime < stopTime);\r
+                       \r
+               System.out.println();\r
+               System.out.println("Resuming cspace services initialization.");\r
+       }\r
+        \r
         //\r
         // Start up and initialize our embedded Nuxeo server instance\r
         //\r
index 6dac00e22559f8a8bb9a0afc87a785d360ac220a..0f1d9aa3f9f1b101894ef8ae4702f79e65f7eefc 100644 (file)
@@ -821,7 +821,7 @@ public class AuthorizationCommon {
                                                Profiler profiler = new Profiler(AuthorizationCommon.class, 1);\r
                                                profiler.start("createDefaultPermissions started:" + readonlyPerm.getCsid());\r
                                                persist(em, readonlyPerm, readonlyRole, true);\r
-                                               profiler.stop("createDefaultPermissions finished:" + readonlyPerm.getCsid());\r
+                                               profiler.stop();\r
                                                logger.debug("Finished full perm generation for "\r
                                                                + ":" + tenantBinding.getId()\r
                                                                + ":" + serviceBinding.getName()\r