Coverage Report - org.kuali.rice.test.BaseTestServer
 
Classes in this File Line Coverage Branch Coverage Complexity
BaseTestServer
0%
0/13
0%
0/6
2
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.test;
 17  
 
 18  
 import org.kuali.rice.core.api.lifecycle.Lifecycle;
 19  
 import org.mortbay.jetty.Server;
 20  
 
 21  
 /**
 22  
  * Abstract class to provide convenience methods for starting and stopping a
 23  
  * Jetty Server instance.
 24  
  * 
 25  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 26  
  * @since 0.9
 27  
  */
 28  0
 public abstract class BaseTestServer implements Lifecycle {
 29  
 
 30  
     private Server server;
 31  
 
 32  
     protected abstract Server createServer();
 33  
 
 34  
     public Server getServer() {
 35  0
         return this.server;
 36  
     }
 37  
 
 38  
     public void start() throws Exception {
 39  0
         this.server = createServer();
 40  0
         if (this.server == null) {
 41  0
                 throw new RuntimeException("Server not successfully created for class: " + getClass().getName());
 42  
         }
 43  0
         this.server.start();
 44  0
     }
 45  
 
 46  
     public void stop() throws Exception {
 47  0
         if (this.server != null) {
 48  0
                 this.server.stop();
 49  
         }
 50  0
     }
 51  
 
 52  
     public boolean isStarted() {
 53  0
         if (this.server == null) {
 54  0
                 return false;
 55  
         }
 56  0
             return this.server.isStarted();
 57  
     }
 58  
 }