BoneCPConfig implements BoneCPConfigMBean, Cloneable, Serializable { public int getMinConnectionsPerPartition() { return this.minConnectionsPerPartition; } BoneCPConfig();  BoneCPConfig(Properties props);  BoneCPConfig(String sectionName);  BoneCPConfig(InputStream xmlConfigFile, String sectionName); String getPoolName(); void setPoolName(String poolName); int getMinConnectionsPerPartition(); void setMinConnectionsPerPartition(int minConnectionsPerPartition); int getMaxConnectionsPerPartition(); void setMaxConnectionsPerPartition(int maxConnectionsPerPartition); int getAcquireIncrement(); void setAcquireIncrement(int acquireIncrement); int getPartitionCount(); void setPartitionCount(int partitionCount); String getJdbcUrl(); void setJdbcUrl(String jdbcUrl); String getUsername(); void setUsername(String username); void setUser(String username); String getUser(); String getPassword(); void setPassword(String password); @Deprecated long getIdleConnectionTestPeriod(); @Deprecated void setIdleConnectionTestPeriod(long idleConnectionTestPeriod); long getIdleConnectionTestPeriodInMinutes(); long getIdleConnectionTestPeriod(TimeUnit timeUnit); void setIdleConnectionTestPeriodInMinutes(long idleConnectionTestPeriod); void setIdleConnectionTestPeriodInSeconds(long idleConnectionTestPeriod); void setIdleConnectionTestPeriod(long idleConnectionTestPeriod, TimeUnit timeUnit); @Deprecated long getIdleMaxAge(); long getIdleMaxAge(TimeUnit timeUnit); long getIdleMaxAgeInMinutes(); @Deprecated void setIdleMaxAge(long idleMaxAge); void setIdleMaxAgeInMinutes(long idleMaxAge); void setIdleMaxAgeInSeconds(long idleMaxAge); void setIdleMaxAge(long idleMaxAge, TimeUnit timeUnit); String getConnectionTestStatement(); void setConnectionTestStatement(String connectionTestStatement); @Deprecated int getPreparedStatementsCacheSize(); @Deprecated int getPreparedStatementCacheSize(); @Deprecated void setPreparedStatementsCacheSize(int preparedStatementsCacheSize); void setStatementsCacheSize(int statementsCacheSize); int getStatementsCacheSize(); @Deprecated void setStatementCacheSize(int statementsCacheSize); @Deprecated int getStatementCacheSize(); @Deprecated int getReleaseHelperThreads(); @Deprecated void setReleaseHelperThreads(int releaseHelperThreads); @Deprecated int getStatementsCachedPerConnection(); @Deprecated void setStatementsCachedPerConnection(int statementsCachedPerConnection); ConnectionHook getConnectionHook(); void setConnectionHook(ConnectionHook connectionHook); String getInitSQL(); void setInitSQL(String initSQL); boolean isCloseConnectionWatch(); void setCloseConnectionWatch(boolean closeConnectionWatch); boolean isLogStatementsEnabled(); void setLogStatementsEnabled(boolean logStatementsEnabled); @Deprecated long getAcquireRetryDelay(); @Deprecated void setAcquireRetryDelay(int acquireRetryDelayInMs); long getAcquireRetryDelayInMs(); long getAcquireRetryDelay(TimeUnit timeUnit); void setAcquireRetryDelayInMs(long acquireRetryDelay); void setAcquireRetryDelay(long acquireRetryDelay, TimeUnit timeUnit); boolean isLazyInit(); void setLazyInit(boolean lazyInit); boolean isTransactionRecoveryEnabled(); void setTransactionRecoveryEnabled(boolean transactionRecoveryEnabled); int getAcquireRetryAttempts(); void setAcquireRetryAttempts(int acquireRetryAttempts); void setConnectionHookClassName(String connectionHookClassName); String getConnectionHookClassName(); boolean isDisableJMX(); void setDisableJMX(boolean disableJMX); DataSource getDatasourceBean(); void setDatasourceBean(DataSource datasourceBean); @Deprecated long getQueryExecuteTimeLimit(); @Deprecated void setQueryExecuteTimeLimit(int queryExecuteTimeLimit); long getQueryExecuteTimeLimitInMs(); long getQueryExecuteTimeLimit(TimeUnit timeUnit); void setQueryExecuteTimeLimitInMs(long queryExecuteTimeLimit); void setQueryExecuteTimeLimit(long queryExecuteTimeLimit, TimeUnit timeUnit); int getPoolAvailabilityThreshold(); void setPoolAvailabilityThreshold(int poolAvailabilityThreshold); boolean isDisableConnectionTracking(); void setDisableConnectionTracking(boolean disableConnectionTracking); @Deprecated long getConnectionTimeout(); @Deprecated void setConnectionTimeout(long connectionTimeout); long getConnectionTimeoutInMs(); long getConnectionTimeout(TimeUnit timeUnit); void setConnectionTimeoutInMs(long connectionTimeoutinMs); void setConnectionTimeout(long connectionTimeout, TimeUnit timeUnit); Properties getDriverProperties(); void setDriverProperties(Properties driverProperties); @Deprecated long getCloseConnectionWatchTimeout(); @Deprecated void setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout); long getCloseConnectionWatchTimeoutInMs(); long getCloseConnectionWatchTimeout(TimeUnit timeUnit); void setCloseConnectionWatchTimeoutInMs(long closeConnectionWatchTimeout); void setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout, TimeUnit timeUnit); @Deprecated int getStatementReleaseHelperThreads(); @Deprecated void setStatementReleaseHelperThreads(int statementReleaseHelperThreads); @Deprecated long getMaxConnectionAge(); long getMaxConnectionAgeInSeconds(); long getMaxConnectionAge(TimeUnit timeUnit); @Deprecated void setMaxConnectionAge(long maxConnectionAgeInSeconds); void setMaxConnectionAgeInSeconds(long maxConnectionAgeInSeconds); void setMaxConnectionAge(long maxConnectionAge, TimeUnit timeUnit); String getConfigFile(); void setConfigFile(String configFile); String getServiceOrder(); void setServiceOrder(String serviceOrder); boolean isStatisticsEnabled(); void setStatisticsEnabled(boolean statisticsEnabled); boolean getDefaultAutoCommit(); void setDefaultAutoCommit(boolean defaultAutoCommit); Boolean getDefaultReadOnly(); void setDefaultReadOnly(Boolean defaultReadOnly); String getDefaultCatalog(); void setDefaultCatalog(String defaultCatalog); String getDefaultTransactionIsolation(); void setDefaultTransactionIsolation(String defaultTransactionIsolation); void setProperties(Properties props); boolean isExternalAuth(); void setExternalAuth(boolean externalAuth); void sanitize(); @Override String toString(); ClassLoader getClassLoader(); void setClassLoader(ClassLoader classLoader); @Override BoneCPConfig clone(); boolean hasSameConfiguration(BoneCPConfig that); boolean isDeregisterDriverOnClose(); void setDeregisterDriverOnClose(boolean deregisterDriverOnClose); boolean isNullOnConnectionTimeout(); void setNullOnConnectionTimeout(boolean nullOnConnectionTimeout); boolean isResetConnectionOnClose(); void setResetConnectionOnClose(boolean resetConnectionOnClose); boolean isDetectUnresolvedTransactions(); void setDetectUnresolvedTransactions(boolean detectUnresolvedTransactions); String getPoolStrategy(); void setPoolStrategy(String poolStrategy); boolean isCloseOpenStatements(); void setCloseOpenStatements(boolean closeOpenStatements); boolean isDetectUnclosedStatements(); void setDetectUnclosedStatements(boolean detectUnclosedStatements); void setClientInfo(Properties properties); Properties getClientInfo();  }
@Test public void testXMLConfig() throws Exception{ BoneCPConfig config = new BoneCPConfig("specialApp"); assertEquals(99, config.getMinConnectionsPerPartition()); }
@Test public void testXMLConfig2() throws Exception{ BoneCPConfig config = new BoneCPConfig("specialApp2"); assertEquals(123, config.getMinConnectionsPerPartition()); }
@Test public void testXmlConfigViaInputStream() throws Exception{ BoneCPConfig config = new BoneCPConfig(this.getClass().getResourceAsStream("/bonecp-config.xml"), "specialApp"); assertEquals(99, config.getMinConnectionsPerPartition()); }
@Test public void testXMLConfigWithUnfoundSection() throws Exception{ BoneCPConfig config = new BoneCPConfig("non-existant"); assertEquals(0, config.getMinConnectionsPerPartition()); }