Coverage Report - org.apache.tomcat.maven.it.AbstractTomcatRunMultiConfigIT
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractTomcatRunMultiConfigIT
0 %
0/18
N/A
1,5
 
 1  
 package org.apache.tomcat.maven.it;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 
 23  
 import org.apache.maven.it.VerificationException;
 24  
 import org.junit.Test;
 25  
 import org.slf4j.Logger;
 26  
 import org.slf4j.LoggerFactory;
 27  
 
 28  
 import java.io.File;
 29  
 import java.net.URI;
 30  
 import java.net.URISyntaxException;
 31  
 
 32  
 import static junitx.framework.StringAssert.assertContains;
 33  
 import static org.junit.Assert.assertNotNull;
 34  
 import static org.junit.Assert.assertTrue;
 35  
 
 36  
 /**
 37  
  * Tests a bunch of configuration options for the tomcat-run Mojo.
 38  
  *
 39  
  * @author Mark Michaelis
 40  
  */
 41  0
 public abstract class AbstractTomcatRunMultiConfigIT
 42  
     extends AbstractWarProjectIT
 43  
 {
 44  0
     private static final Logger LOG = LoggerFactory.getLogger( AbstractTomcatRunMultiConfigIT.class );
 45  
 
 46  
     private static final String URL_QUERY = "\u3053\u3093\u306b\u3061\u306f";
 47  
 
 48  
     /**
 49  
      * ArtifactId of the sample WAR project.
 50  
      */
 51  
     private static final String WAR_ARTIFACT_ID = "tomcat-run-multi-config";
 52  
 
 53  
     @Override
 54  
     protected String getWebappUrl()
 55  
     {
 56  
         try
 57  
         {
 58  0
             return new URI(
 59  
                 "http://localhost:" + getHttpItPort() + "/multi-config/index.jsp?string=" + URL_QUERY ).toASCIIString();
 60  
         }
 61  0
         catch ( URISyntaxException e )
 62  
         {
 63  0
             LOG.error( "An exception occurred.", e );
 64  0
             return "http://localhost:" + getHttpItPort() + "/multi-config";
 65  
         }
 66  
     }
 67  
 
 68  
     @Override
 69  
     protected String getWarArtifactId()
 70  
     {
 71  0
         return WAR_ARTIFACT_ID;
 72  
     }
 73  
 
 74  
     @Test
 75  
     public void testIt()
 76  
         throws Exception
 77  
     {
 78  0
         final String responseBody = executeVerifyWithGet();
 79  0
         assertNotNull( "Received message body from " + getWebappUrl() + " must not be null.", responseBody );
 80  0
         assertContains( "Response from " + getWebappUrl() + " must match expected content.", URL_QUERY, responseBody );
 81  
 
 82  0
         final File tomcatFolder = new File( webappHome, "target/tc" );
 83  0
         final File emptyLocation = new File( tomcatFolder, "conf/empty.txt" );
 84  
 
 85  0
         assertTrue(
 86  
             "Tomcat folder \"" + tomcatFolder.getAbsolutePath() + "\" should exist in target folder of project at "
 87  
                 + webappHome, tomcatFolder.exists() );
 88  0
         assertTrue(
 89  
             "File \"" + emptyLocation.getAbsolutePath() + "\" should have been copied from tcconf to tomcat/conf",
 90  
             emptyLocation.exists() );
 91  
 
 92  0
         LOG.info( "Error Free Log check" );
 93  0
         verifier.verifyErrorFreeLog();
 94  0
         verifyConnectorsStarted();
 95  
 
 96  0
     }
 97  
 
 98  
     /**
 99  
      * impls check the logs if http/https/apr has been started
 100  
      */
 101  
     protected abstract void verifyConnectorsStarted()
 102  
         throws VerificationException;
 103  
 
 104  
 }