|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.test4j.tools.commons.ConfigHelper
public class ConfigHelper
test4j配置文件工具类
| 字段摘要 | |
|---|---|
static String |
PROPKEY_DATABASE_DIALECT
Property key of the SQL dialect of the underlying DBMS implementation |
| 构造方法摘要 | |
|---|---|
ConfigHelper()
|
|
| 方法摘要 | ||
|---|---|---|
static boolean |
autoExport()
|
|
static String |
databaseDriver()
默认数据库驱动class |
|
static String |
databasePassword()
|
|
static String |
databaseType()
默认的数据库类型 |
|
static String |
databaseUrl()
默认数据库连接url |
|
static String |
databaseUserName()
|
|
static String |
dbfitDir()
dbfit测试结果文件输出目录 |
|
static void |
disableDbMaintain()
|
|
static boolean |
doesDisableConstraints()
|
|
static boolean |
doesOnlyTestDatabase()
除非显示的声明了database.istest=false,否则test4j认为只能连接测试库 |
|
static boolean |
getBoolean(String key)
|
|
static boolean |
getBoolean(String key,
boolean defaultValue)
|
|
static Properties |
getConfiguration()
Returns all properties that are used to configure test4j. |
|
static String |
getConfiguredClassName(Class type,
String... implementationDiscriminatorValues)
Retrieves the class name of the concrete instance of the class with the given type as configured by the given Configuration. |
|
static
|
getInstance(String clazNameProperty)
Gets an instance of the type specified by the property with the given name. |
|
static
|
getInstanceOf(Class<? extends T> type,
String... implementationDiscriminatorValues)
Retrieves the concrete instance of the class with the given type as configured by the given Configuration. |
|
static int |
getInteger(String key,
int defaultValue)
|
|
static String |
getString(Properties properties,
String key)
先从properties中获取key的属性值,如果找不到再从test4j配置中查找 Gets the string value for the property with the given name. |
|
static String |
getString(Properties properties,
String key,
String defaultValue)
Gets the string value for the property with the given name. |
|
static String |
getString(String key)
|
|
static String |
getString(String key,
String defaultValue)
获取test4j配置项 |
|
static List<String> |
getStringList(String propertyName)
Gets the list of comma separated string values for the property with the given name. |
|
static List<String> |
getStringList(String propertyName,
boolean required)
Gets the list of comma separated string values for the property with the given name. |
|
static boolean |
hasProperty(String key)
Checks whether the property with the given name exists in the test4j or in the given properties. |
|
static boolean |
isScript()
|
|
static boolean |
isSpringDataSourceName(String beanName)
判断是否是spring的data source bean name beanName.equals("spring.datasource.name")是为了兼容老版本中属性的定义 |
|
static int |
logLevel()
返回log级别 |
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final String PROPKEY_DATABASE_DIALECT
| 构造方法详细信息 |
|---|
public ConfigHelper()
| 方法详细信息 |
|---|
public static Properties getConfiguration()
Properties objectpublic static int logLevel()
public static String getString(String key)
public static String getString(String key,
String defaultValue)
key - defaultValue - 默认值
public static String getString(Properties properties,
String key)
properties - key -
public static String getString(Properties properties,
String key,
String defaultValue)
propertyName - The name, not nulldefaultValue - The default valueproperties - The properties, not null
public static List<String> getStringList(String propertyName)
propertyName - The name, not null
public static List<String> getStringList(String propertyName,
boolean required)
propertyName - The name, not nullrequired - If true an exception will be raised when the property is
not found or empty
public static boolean getBoolean(String key)
public static boolean getBoolean(String key,
boolean defaultValue)
public static int getInteger(String key,
int defaultValue)
public static boolean hasProperty(String key)
key - The property name, not null
public static <T> T getInstance(String clazNameProperty)
clazNameProperty - the property of class name, not null.
public static <T> T getInstanceOf(Class<? extends T> type,
String... implementationDiscriminatorValues)
Configuration. Tries to retrieve a
specific implementation first (propery key = fully qualified name of the
interface type + '.impl.className.' + implementationDiscriminatorValue).
If this key does not exist, the generally configured instance is
retrieved (same property key without the
implementationDiscriminatorValue).
type - The type of the instanceimplementationDiscriminatorValues - The values that define which
specific implementation class should be used. This is
typically an environment specific property, like the DBMS that
is used.
public static String databaseDriver()
public static String databaseUrl()
public static String databaseUserName()
public static String databasePassword()
public static boolean doesDisableConstraints()
public static boolean doesOnlyTestDatabase()
public static boolean isSpringDataSourceName(String beanName)
beanName -
public static boolean autoExport()
public static boolean isScript()
public static String databaseType()
public static String dbfitDir()
public static void disableDbMaintain()
public static String getConfiguredClassName(Class type,
String... implementationDiscriminatorValues)
Configuration. Tries
to retrieve a specific implementation first (propery key = fully
qualified name of the interface type + '.impl.className.' +
implementationDiscriminatorValue). If this key does not exist, the
generally configured instance is retrieved (same property key without the
implementationDiscriminatorValue).
type - The type of the instanceimplementationDiscriminatorValues - The values that define which
specific implementation class should be used. This is
typically an environment specific property, like the DBMS that
is used.
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||