incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1327487 - in /incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests: BaseDerby.java CMISServer.java
Date Wed, 18 Apr 2012 12:48:36 GMT
Author: kwright
Date: Wed Apr 18 12:48:36 2012
New Revision: 1327487

URL: http://svn.apache.org/viewvc?rev=1327487&view=rev
Log:
Separate out CMISServer logic so we can reuse it.

Added:
    incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/CMISServer.java
  (with props)
Modified:
    incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/BaseDerby.java

Modified: incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/BaseDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/BaseDerby.java?rev=1327487&r1=1327486&r2=1327487&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/BaseDerby.java
(original)
+++ incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/BaseDerby.java
Wed Apr 18 12:48:36 2012
@@ -22,10 +22,6 @@ import org.apache.manifoldcf.crawler.sys
 import org.junit.After;
 import org.junit.Before;
 
-import org.eclipse.jetty.server.handler.ContextHandlerCollection;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.webapp.WebAppContext;
-
 /** Tests that run the "agents daemon" should be derived from this 
  * 
  *  @author Piergiorgio Lucidi
@@ -33,7 +29,7 @@ import org.eclipse.jetty.webapp.WebAppCo
  * */
 public class BaseDerby extends org.apache.manifoldcf.crawler.tests.BaseITDerby
 {
-  protected Server cmisServer = null;
+  protected CMISServer cmisServer = null;
 
   
   protected String[] getConnectorNames()
@@ -62,37 +58,20 @@ public class BaseDerby extends org.apach
   public void setUpCMIS()
     throws Exception
   {
-    cmisServer = new Server(9090);
-    cmisServer.setStopAtShutdown(true);
-
     String openCmisServerWarPath = "../../lib/chemistry-opencmis-server-inmemory.war";
 
     if (System.getProperty("openCmisServerWarPath") != null)
       openCmisServerWarPath = System.getProperty("openCmisServerWarPath");
-    
-    //Initialize OpenCMIS Server bindings
-    ContextHandlerCollection contexts = new ContextHandlerCollection();
-    cmisServer.setHandler(contexts);
 
-    WebAppContext openCmisServerApi = new WebAppContext(openCmisServerWarPath,"/chemistry-opencmis-server-inmemory");
-    openCmisServerApi.setParentLoaderPriority(false);
-    contexts.addHandler(openCmisServerApi);
-    
+    cmisServer = new CMISServer(9090, openCmisServerWarPath);
     cmisServer.start();
-    boolean entered = false;
-    
-    while(cmisServer.isStarted() 
-        && openCmisServerApi.isStarted()
-        && !entered){
-      entered = true;
-      ManifoldCF.sleep(5000);
-    }
   }
   
   @After
   public void cleanUpCMIS()
     throws Exception
   {
+    cmisServer.stop();
   }
   
 }

Added: incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/CMISServer.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/CMISServer.java?rev=1327487&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/CMISServer.java
(added)
+++ incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/CMISServer.java
Wed Apr 18 12:48:36 2012
@@ -0,0 +1,64 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.cmis_tests;
+
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.webapp.WebAppContext;
+
+/** Class representing an instance of CMIS Server
+ */
+public class CMISServer
+{
+  protected Server cmisServer = null;
+
+  public CMISServer(int port, String warPath)
+  {
+    cmisServer = new Server(port);
+    cmisServer.setStopAtShutdown(true);
+
+    //Initialize OpenCMIS Server bindings
+    ContextHandlerCollection contexts = new ContextHandlerCollection();
+    cmisServer.setHandler(contexts);
+
+    WebAppContext openCmisServerApi = new WebAppContext(warPath,"/chemistry-opencmis-server-inmemory");
+    openCmisServerApi.setParentLoaderPriority(false);
+    contexts.addHandler(openCmisServerApi);
+  }
+  
+  public void start()
+    throws Exception
+  {
+    cmisServer.start();
+    boolean entered = false;
+    
+    while(cmisServer.isStarted() 
+        && openCmisServerApi.isStarted()
+        && !entered){
+      entered = true;
+      Thread.sleep(5000);
+    }
+  }
+  
+  public void stop()
+    throws Exception
+  {
+  }
+
+}

Propchange: incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/CMISServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-459/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/CMISServer.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message