test_class.declarator: mockPool
test_class.modifier: private static
test_class.original_string: private static BoneCP mockPool;
test_class.type: BoneCP
test_class.var_name: mockPool
test_class.declarator: mockConnection
test_class.modifier: private static
test_class.original_string: private static ConnectionHandle mockConnection;
test_class.type: ConnectionHandle
test_class.var_name: mockConnection
test_class.declarator: mockProperties
test_class.modifier: private static
test_class.original_string: private static Properties mockProperties;
test_class.type: Properties
test_class.var_name: mockProperties
test_class.declarator: testClass
test_class.modifier: private static
test_class.original_string: private static BoneCPConnectionProvider testClass;
test_class.type: BoneCPConnectionProvider
test_class.var_name: testClass
test_class.declarator: URL = "jdbc:mock"
test_class.modifier: private static
test_class.original_string: private static String URL = "jdbc:mock";
test_class.type: String
test_class.var_name: URL
test_class.declarator: USERNAME = "sa"
test_class.modifier: private static
test_class.original_string: private static String USERNAME = "sa";
test_class.type: String
test_class.var_name: USERNAME
test_class.declarator: PASSWORD = ""
test_class.modifier: private static
test_class.original_string: private static String PASSWORD = "";
test_class.type: String
test_class.var_name: PASSWORD
test_class.declarator: DRIVER = "com.jolbox.bonecp.MockJDBCDriver"
test_class.modifier: private static
test_class.original_string: private static String DRIVER = "com.jolbox.bonecp.MockJDBCDriver";
test_class.type: String
test_class.var_name: DRIVER
test_class.declarator: TEST_QUERY = "SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
test_class.modifier: public static final
test_class.original_string: public static final String TEST_QUERY = "SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS";
test_class.type: String
test_class.var_name: TEST_QUERY
test_class.declarator: driver
test_class.modifier: private
test_class.original_string: private MockJDBCDriver driver;
test_class.type: MockJDBCDriver
test_class.var_name: driver
test_class.file: bonecp-hbnprovider/src/test/java/com/jolbox/bonecp/provider/TestBoneCPConnectionProvider.java
test_class.identifier: TestBoneCPConnectionProvider
test_case.body: @Test
  	@SuppressWarnings("deprecation")
  	public void testConfigure() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, NoSuchMethodException, ClassNotFoundException, SQLException {
  		
  		Class.forName("com.jolbox.bonecp.MockJDBCDriver");
  		expect(mockProperties.getProperty("bonecp.statementsCacheSize")).andReturn("40").anyTimes();
  		expect(mockProperties.getProperty("bonecp.minConnectionsPerPartition")).andReturn("20").anyTimes();
  		expect(mockProperties.getProperty("bonecp.maxConnectionsPerPartition")).andReturn("50").anyTimes(); 
  		expect(mockProperties.getProperty("bonecp.acquireIncrement")).andReturn("5").anyTimes();
  		expect(mockProperties.getProperty("bonecp.partitionCount")).andReturn("5").anyTimes();
  		expect(mockProperties.getProperty("bonecp.releaseHelperThreads")).andReturn("3").anyTimes();
  		expect(mockProperties.getProperty("bonecp.idleConnectionTestPeriod")).andReturn("60").anyTimes();
  		expect(mockProperties.getProperty("bonecp.idleMaxAge")).andReturn("240").anyTimes();
  		expect(mockProperties.getProperty("javax.persistence.jdbc.url")).andReturn(URL).anyTimes();
  		expect(mockProperties.getProperty("javax.persistence.jdbc.user")).andReturn(USERNAME).anyTimes();
  		expect(mockProperties.getProperty("javax.persistence.jdbc.password")).andReturn(PASSWORD).anyTimes();
  		expect(mockProperties.getProperty("javax.persistence.jdbc.driver")).andReturn(DRIVER).anyTimes();
  		expect(mockProperties.getProperty("bonecp.connectionHookClassName")).andReturn("com.jolbox.bonecp.provider.CustomHook").anyTimes();
  		expect(mockProperties.getProperty("bonecp.connectionTestStatement")).andReturn(TEST_QUERY).anyTimes();
  		expect(mockProperties.getProperty("bonecp.initSQL")).andReturn(TEST_QUERY).anyTimes();
  		expect(mockProperties.getProperty("bonecp.logStatementsEnabled")).andReturn("true").anyTimes();
  
  
  
  		BoneCPConnectionProvider partialTestClass = createMockBuilder(BoneCPConnectionProvider.class).addMockedMethod( 
  				BoneCPConnectionProvider.class.getDeclaredMethod("createPool", BoneCPConfig.class)).createMock();
  		expect(partialTestClass.createPool((BoneCPConfig)anyObject())).andReturn(mockPool).once();
  		
  		replay(mockProperties, partialTestClass);
  		partialTestClass.configure(mockProperties);
  
  		// fetch the configuration object and check that everything is as we passed
  		BoneCPConfig config = partialTestClass.getConfig();
  
  		assertEquals(40, config.getStatementsCacheSize());
  //		assertEquals(30, config.getStatementsCachedPerConnection());
  		assertEquals(20, config.getMinConnectionsPerPartition());
  		assertEquals(50, config.getMaxConnectionsPerPartition());
  		assertEquals(5, config.getAcquireIncrement());
  		assertEquals(5, config.getPartitionCount());
  		assertEquals(3, config.getReleaseHelperThreads());
  		assertEquals(60, config.getIdleConnectionTestPeriodInMinutes());
  		assertEquals(240, config.getIdleMaxAgeInMinutes()); 
  		assertEquals(URL, config.getJdbcUrl());
  		assertEquals(USERNAME, config.getUsername());
  		assertEquals(PASSWORD, config.getPassword());
  		assertEquals(TEST_QUERY, config.getInitSQL());
  		assertEquals(true, config.isLogStatementsEnabled());
  
  
  		verify(mockProperties, partialTestClass);
  		reset(mockProperties);
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_DRIVER_CLASS)).andReturn(null).anyTimes();
  		replay(mockProperties);
  		try{
  			testClass.configure(mockProperties);
  			fail("Should have failed with exception");
  		} catch (HibernateException e){ 
  			// do nothing
  		}
  
  		reset(mockProperties);
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_DRIVER_CLASS)).andReturn(DRIVER).anyTimes();
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_URL, "JDBC URL NOT SET IN CONFIG")).andReturn("somethinginvalid").anyTimes();
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_USERNAME, "username not set")).andReturn(USERNAME).anyTimes();
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_PASSWORD, "password not set")).andReturn(PASSWORD).anyTimes();
  
  		replay(mockProperties);
  		try{
  			testClass.configure(mockProperties);
  			fail("Should have failed with exception");
  		} catch (HibernateException e){
  			// do nothing
  		}
  		
  
  		verify(mockProperties);
  		reset(mockProperties);
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_DRIVER_CLASS)).andReturn("somethingbad").anyTimes();
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_URL, "JDBC URL NOT SET IN CONFIG")).andReturn("somethinginvalid").anyTimes();
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_USERNAME, "username not set")).andReturn(USERNAME).anyTimes();
  		expect(mockProperties.getProperty(CONFIG_CONNECTION_PASSWORD, "password not set")).andReturn(PASSWORD).anyTimes();
  
  		replay(mockProperties);
  		try{
  			testClass.configure(mockProperties);
  			fail("Should have failed with exception");
  		} catch (HibernateException e){ 
  			// do nothing
  		}
  
  		testClass.setClassLoader(getClass().getClassLoader());
  		testClass.loadClass("java.lang.String");
  
  		testClass.setClassLoader(this.getClass().getClassLoader());
  		assertEquals(this.getClass().getClassLoader(), testClass.getClassLoader());
  		
  		// coverage stuff
  		reset(mockProperties);
  		expect(mockProperties.getProperty("bonecp.partitionCount")).andReturn("something bad");
  		expect(mockProperties.getProperty("bonecp.logStatementsEnabled")).andReturn("something bad");
  		expect(mockProperties.getProperty("bonecp.idleMaxAge")).andReturn("something bad");
  		replay(mockProperties);
  		try{
  			testClass.configure(mockProperties);
  			fail("Should have failed with exception");
  		} catch (HibernateException e){ 
  			// do nothing
  		}
  		
  	}
test_case.class_method_signature: TestBoneCPConnectionProvider.testConfigure()
test_case.full_signature: @Test @SuppressWarnings("deprecation") public void testConfigure()
test_case.identifier: testConfigure
test_case.invocations: forName anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty createMock addMockedMethod createMockBuilder getDeclaredMethod once andReturn expect createPool anyObject replay configure getConfig assertEquals getStatementsCacheSize assertEquals getMinConnectionsPerPartition assertEquals getMaxConnectionsPerPartition assertEquals getAcquireIncrement assertEquals getPartitionCount assertEquals getReleaseHelperThreads assertEquals getIdleConnectionTestPeriodInMinutes assertEquals getIdleMaxAgeInMinutes assertEquals getJdbcUrl assertEquals getUsername assertEquals getPassword assertEquals getInitSQL assertEquals isLogStatementsEnabled verify reset anyTimes andReturn expect getProperty replay configure fail reset anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty replay configure fail verify reset anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty anyTimes andReturn expect getProperty replay configure fail setClassLoader getClassLoader getClass loadClass setClassLoader getClassLoader getClass assertEquals getClassLoader getClass getClassLoader reset andReturn expect getProperty andReturn expect getProperty andReturn expect getProperty replay configure fail
test_case.modifiers: @Test @SuppressWarnings("deprecation") public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testConfigure()
focal_class.declarator: serialVersionUID = -5236029951415598543L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = -5236029951415598543L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: CONFIG_CONNECTION_DRIVER_CLASS = "hibernate.connection.driver_class"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_DRIVER_CLASS = "hibernate.connection.driver_class";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_DRIVER_CLASS
focal_class.declarator: CONFIG_CONNECTION_PASSWORD = "hibernate.connection.password"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_PASSWORD = "hibernate.connection.password";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_PASSWORD
focal_class.declarator: CONFIG_CONNECTION_USERNAME = "hibernate.connection.username"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_USERNAME = "hibernate.connection.username";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_USERNAME
focal_class.declarator: CONFIG_CONNECTION_URL = "hibernate.connection.url"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_URL = "hibernate.connection.url";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_URL
focal_class.declarator: CONFIG_CONNECTION_DRIVER_CLASS_ALTERNATE = "javax.persistence.jdbc.driver"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_DRIVER_CLASS_ALTERNATE = "javax.persistence.jdbc.driver";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_DRIVER_CLASS_ALTERNATE
focal_class.declarator: CONFIG_CONNECTION_PASSWORD_ALTERNATE = "javax.persistence.jdbc.password"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_PASSWORD_ALTERNATE = "javax.persistence.jdbc.password";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_PASSWORD_ALTERNATE
focal_class.declarator: CONFIG_CONNECTION_USERNAME_ALTERNATE = "javax.persistence.jdbc.user"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_USERNAME_ALTERNATE = "javax.persistence.jdbc.user";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_USERNAME_ALTERNATE
focal_class.declarator: CONFIG_CONNECTION_URL_ALTERNATE = "javax.persistence.jdbc.url"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String CONFIG_CONNECTION_URL_ALTERNATE = "javax.persistence.jdbc.url";
focal_class.type: String
focal_class.var_name: CONFIG_CONNECTION_URL_ALTERNATE
focal_class.declarator: pool
focal_class.modifier: private
focal_class.original_string: private BoneCP pool;
focal_class.type: BoneCP
focal_class.var_name: pool
focal_class.declarator: isolation
focal_class.modifier: private
focal_class.original_string: private Integer isolation;
focal_class.type: Integer
focal_class.var_name: isolation
focal_class.declarator: autocommit
focal_class.modifier: private
focal_class.original_string: private boolean autocommit;
focal_class.type: boolean
focal_class.var_name: autocommit
focal_class.declarator: classLoader
focal_class.modifier: private
focal_class.original_string: private ClassLoader classLoader;
focal_class.type: ClassLoader
focal_class.var_name: classLoader
focal_class.declarator: config
focal_class.modifier: private
focal_class.original_string: private BoneCPConfig config;
focal_class.type: BoneCPConfig
focal_class.var_name: config
focal_class.declarator: logger = LoggerFactory.getLogger(BoneCPConnectionProvider.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(BoneCPConnectionProvider.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: bonecp-hbnprovider/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java
focal_class.identifier: BoneCPConnectionProvider
focal_class.interfaces: implements ConnectionProvider,Configurable,Stoppable
focal_class.class_method_signature: BoneCPConnectionProvider.closeConnection(Connection conn)
focal_class.full_signature: public void closeConnection(Connection conn)
focal_class.identifier: closeConnection
focal_class.modifiers: public
focal_class.parameters: (Connection conn)
focal_class.return: void
focal_class.signature: void closeConnection(Connection conn)
focal_class.class_method_signature: BoneCPConnectionProvider.configure(Properties props)
focal_class.full_signature: public void configure(Properties props)
focal_class.identifier: configure
focal_class.modifiers: public
focal_class.parameters: (Properties props)
focal_class.return: void
focal_class.signature: void configure(Properties props)
focal_class.class_method_signature: BoneCPConnectionProvider.loadClass(String clazz)
focal_class.full_signature: protected Class<?> loadClass(String clazz)
focal_class.identifier: loadClass
focal_class.modifiers: protected
focal_class.parameters: (String clazz)
focal_class.return: Class<?>
focal_class.signature: Class<?> loadClass(String clazz)
focal_class.class_method_signature: BoneCPConnectionProvider.createPool(BoneCPConfig config)
focal_class.full_signature: protected BoneCP createPool(BoneCPConfig config)
focal_class.identifier: createPool
focal_class.modifiers: protected
focal_class.parameters: (BoneCPConfig config)
focal_class.return: BoneCP
focal_class.signature: BoneCP createPool(BoneCPConfig config)
focal_class.class_method_signature: BoneCPConnectionProvider.getConnection()
focal_class.full_signature: public Connection getConnection()
focal_class.identifier: getConnection
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Connection
focal_class.signature: Connection getConnection()
focal_class.class_method_signature: BoneCPConnectionProvider.supportsAggressiveRelease()
focal_class.full_signature: public boolean supportsAggressiveRelease()
focal_class.identifier: supportsAggressiveRelease
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean supportsAggressiveRelease()
focal_class.class_method_signature: BoneCPConnectionProvider.getConfig()
focal_class.full_signature: protected BoneCPConfig getConfig()
focal_class.identifier: getConfig
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: BoneCPConfig
focal_class.signature: BoneCPConfig getConfig()
focal_class.class_method_signature: BoneCPConnectionProvider.getClassLoader()
focal_class.full_signature: public ClassLoader getClassLoader()
focal_class.identifier: getClassLoader
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ClassLoader
focal_class.signature: ClassLoader getClassLoader()
focal_class.class_method_signature: BoneCPConnectionProvider.setClassLoader(ClassLoader classLoader)
focal_class.full_signature: public void setClassLoader(ClassLoader classLoader)
focal_class.identifier: setClassLoader
focal_class.modifiers: public
focal_class.parameters: (ClassLoader classLoader)
focal_class.return: void
focal_class.signature: void setClassLoader(ClassLoader classLoader)
focal_class.class_method_signature: BoneCPConnectionProvider.isUnwrappableAs(Class unwrapType)
focal_class.full_signature: @Override @SuppressWarnings("rawtypes") public boolean isUnwrappableAs(Class unwrapType)
focal_class.identifier: isUnwrappableAs
focal_class.modifiers: @Override @SuppressWarnings("rawtypes") public
focal_class.parameters: (Class unwrapType)
focal_class.return: boolean
focal_class.signature: boolean isUnwrappableAs(Class unwrapType)
focal_class.class_method_signature: BoneCPConnectionProvider.unwrap(Class<T> unwrapType)
focal_class.full_signature: @SuppressWarnings("unchecked") @Override public T unwrap(Class<T> unwrapType)
focal_class.identifier: unwrap
focal_class.modifiers: @SuppressWarnings("unchecked") @Override public
focal_class.parameters: (Class<T> unwrapType)
focal_class.return: T
focal_class.signature: T unwrap(Class<T> unwrapType)
focal_class.class_method_signature: BoneCPConnectionProvider.mapToProperties(Map<String, String> map)
focal_class.full_signature: private Properties mapToProperties(Map<String, String> map)
focal_class.identifier: mapToProperties
focal_class.modifiers: private
focal_class.parameters: (Map<String, String> map)
focal_class.return: Properties
focal_class.signature: Properties mapToProperties(Map<String, String> map)
focal_class.class_method_signature: BoneCPConnectionProvider.configure(Map configurationValues)
focal_class.full_signature: @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void configure(Map configurationValues)
focal_class.identifier: configure
focal_class.modifiers: @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public
focal_class.parameters: (Map configurationValues)
focal_class.return: void
focal_class.signature: void configure(Map configurationValues)
focal_class.class_method_signature: BoneCPConnectionProvider.stop()
focal_class.full_signature: @Override public void stop()
focal_class.identifier: stop
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void stop()
focal_class.class_method_signature: BoneCPConnectionProvider.close()
focal_class.full_signature: public void close()
focal_class.identifier: close
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_method.body: public void configure(Properties props) throws HibernateException {
  		try{
  			this.config = new BoneCPConfig(props);
  
  			// old hibernate config
  			String url = props.getProperty(CONFIG_CONNECTION_URL);
  			String username = props.getProperty(CONFIG_CONNECTION_USERNAME);
  			String password = props.getProperty(CONFIG_CONNECTION_PASSWORD);
  			String driver = props.getProperty(CONFIG_CONNECTION_DRIVER_CLASS);
  			if (url == null){
  				url = props.getProperty(CONFIG_CONNECTION_URL_ALTERNATE);
  			}
  			if (username == null){
  				username = props.getProperty(CONFIG_CONNECTION_USERNAME_ALTERNATE);
  			}
  			if (password == null){
  				password = props.getProperty(CONFIG_CONNECTION_PASSWORD_ALTERNATE);
  			}
  			if (driver == null){
  				driver = props.getProperty(CONFIG_CONNECTION_DRIVER_CLASS_ALTERNATE);
  			}
  
  			if (url != null){
  				this.config.setJdbcUrl(url);
  			}
  			if (username != null){
  				this.config.setUsername(username);
  			}
  			if (password != null){
  				this.config.setPassword(password);
  			}
  
  
  			// Remember Isolation level
  			this.isolation = ConfigurationHelper.getInteger(AvailableSettings.ISOLATION, props);
  			this.autocommit = ConfigurationHelper.getBoolean(AvailableSettings.AUTOCOMMIT, props);
  
  			logger.debug(this.config.toString());
  
  			if (driver != null && !driver.trim().equals("")){
  				loadClass(driver);
  			}
  			if (this.config.getConnectionHookClassName() != null){
  				Object hookClass = loadClass(this.config.getConnectionHookClassName()).newInstance();
  				this.config.setConnectionHook((ConnectionHook) hookClass);
  			}
  			// create the connection pool
  			this.pool = createPool(this.config);
  		} catch (Exception e) {
  			throw new HibernateException(e);
  		}
  	}
focal_method.class_method_signature: BoneCPConnectionProvider.configure(Properties props)
focal_method.full_signature: public void configure(Properties props)
focal_method.identifier: configure
focal_method.invocations: getProperty getProperty getProperty getProperty getProperty getProperty getProperty getProperty setJdbcUrl setUsername setPassword getInteger getBoolean debug toString equals trim loadClass getConnectionHookClassName newInstance loadClass getConnectionHookClassName setConnectionHook createPool
focal_method.modifiers: public
focal_method.parameters: (Properties props)
focal_method.return: void
focal_method.signature: void configure(Properties props)