Coverage Report - com.jcabi.mysql.maven.plugin.Config
 
Classes in this File Line Coverage Branch Coverage Complexity
Config
93%
14/15
0%
0/30
1
 
 1  2
 /**
 2  
  * Copyright (c) 2012-2014, jcabi.com
 3  
  * All rights reserved.
 4  
  *
 5  
  * Redistribution and use in source and binary forms, with or without
 6  
  * modification, are permitted provided that the following conditions
 7  
  * are met: 1) Redistributions of source code must retain the above
 8  
  * copyright notice, this list of conditions and the following
 9  
  * disclaimer. 2) Redistributions in binary form must reproduce the above
 10  
  * copyright notice, this list of conditions and the following
 11  
  * disclaimer in the documentation and/or other materials provided
 12  
  * with the distribution. 3) Neither the name of the jcabi.com nor
 13  
  * the names of its contributors may be used to endorse or promote
 14  
  * products derived from this software without specific prior written
 15  
  * permission.
 16  
  *
 17  
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18  
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
 19  
  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 20  
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 21  
  * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 22  
  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 23  
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 24  
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 25  
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 26  
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 27  
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 28  
  * OF THE POSSIBILITY OF SUCH DAMAGE.
 29  
  */
 30  
 package com.jcabi.mysql.maven.plugin;
 31  
 
 32  
 import java.util.Collections;
 33  
 import java.util.List;
 34  
 import javax.validation.constraints.NotNull;
 35  
 import lombok.EqualsAndHashCode;
 36  
 import lombok.ToString;
 37  
 
 38  
 /**
 39  
  * Configuration POJO.
 40  
  * Contains configuration for particular db instance {@link Instances}
 41  
  *
 42  
  * @author Paul Polischuk (ppol@ua.fm)
 43  
  * @version $Id$
 44  
  * @since 0.6
 45  
  */
 46  8
 @ToString
 47  0
 @EqualsAndHashCode(
 48  
     of = { "tcpport", "dbuser", "dbpassword", "name", "dbopts" }
 49  
 )
 50  
 public final class Config {
 51  
 
 52  
     /**
 53  
      * TCP port.
 54  
      */
 55  
     private final transient int tcpport;
 56  
 
 57  
     /**
 58  
      * Db user name.
 59  
      */
 60  
     private final transient String dbuser;
 61  
 
 62  
     /**
 63  
      * Db password.
 64  
      */
 65  
     private final transient String dbpassword;
 66  
 
 67  
     /**
 68  
      * Db name.
 69  
      */
 70  
     private final transient String name;
 71  
 
 72  
     /**
 73  
      * Configuration options.
 74  
      */
 75  
     private final transient List<String> dbopts;
 76  
 
 77  
     /**
 78  
      * Creates new configuration.
 79  
      * @param port TCP port
 80  
      * @param usr Db user name
 81  
      * @param password Db password
 82  
      * @param dbn Db name
 83  
      * @param opts Configuration options
 84  
      * @checkstyle ParameterNumberCheck (15 lines)
 85  
      */
 86  
     public Config(
 87  
         final int port,
 88  
         @NotNull final String usr,
 89  
         @NotNull final String password,
 90  
         @NotNull final String dbn,
 91  
         @NotNull final List<String> opts
 92  8
     ) {
 93  8
         this.tcpport = port;
 94  8
         this.dbuser = usr;
 95  8
         this.dbpassword = password;
 96  8
         this.name = dbn;
 97  8
         this.dbopts = Collections.unmodifiableList(opts);
 98  8
     }
 99  
 
 100  
     /**
 101  
      * Get TCP port we're on.
 102  
      * @return Port number
 103  
      */
 104  
     public int port() {
 105  50
         return this.tcpport;
 106  
     }
 107  
 
 108  
     /**
 109  
      * Get Db user name.
 110  
      * @return User name
 111  
      */
 112  
     public String user() {
 113  11
         return this.dbuser;
 114  
     }
 115  
 
 116  
     /**
 117  
      * Get Db password.
 118  
      * @return Password
 119  
      */
 120  
     public String password() {
 121  2
         return this.dbpassword;
 122  
     }
 123  
 
 124  
     /**
 125  
      * Get Db name.
 126  
      * @return Database name
 127  
      */
 128  
     public String dbname() {
 129  17
         return this.name;
 130  
     }
 131  
 
 132  
     /**
 133  
      * Get configuration options.
 134  
      * @return Options
 135  
      */
 136  
     public List<String> options() {
 137  8
         return this.dbopts;
 138  
     }
 139  
 }