<commit_before>/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.jboss.jca.core.connectionmanager.unit.pool;

import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * <code>PoolConfiguration</code> unit test.
 * 
 * @author <a href="mailto:<EMAIL>"><NAME></a> 
 * @author <a href="mailto:<EMAIL>"><NAME></a> 
 */
public class PoolConfigurationTestCase
{
   /**
    * Test {@link PoolConfiguration#getMinSize()}
    */
   @Test
   public void testMinSize()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(0, params.getMinSize());
      params.setMinSize(10);
      assertEquals(10, params.getMinSize());
   }

   /**
    * Test {@link PoolConfiguration#getMaxSize()}
    */
   @Test
   public void testMaxSize()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(20, params.getMaxSize());
      params.setMaxSize(30);
      assertEquals(30, params.getMaxSize());      
   }

   /**
    * Test {@link PoolConfiguration#getBlockingTimeout()}
    */
   @Test
   public void testBlockingTimeout()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(30000, params.getBlockingTimeout());
      params.setBlockingTimeout(60000);
      assertEquals(60000, params.getBlockingTimeout());
   }

   /**
    * Test {@link PoolConfiguration#getIdleTimeout()}
    */
   @Test
   public void testIdleTimeout()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(1000 * 60 * 30, params.getIdleTimeout());
      params.setIdleTimeout(1000 * 60 * 20);
      assertEquals(1000 * 60 * 20, params.getIdleTimeout());
   }

   /**
    * Test {@link PoolConfiguration#getBackgroundValidationInterval()}
    */
   @Test
   public void testBackgroundValidationInterval()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(0L, params.getBackgroundValidationInterval());
      params.setBackgroundValidationInterval(50000L);
      assertEquals(50000L, params.getBackgroundValidationInterval());<commit_msg>[JBJCA-405] Test new API<commit_after>/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.jboss.jca.core.connectionmanager.unit.pool;

import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * <code>PoolConfiguration</code> unit test.
 * 
 * @author <a href="mailto:<EMAIL>"><NAME></a> 
 * @author <a href="mailto:<EMAIL>"><NAME></a> 
 */
public class PoolConfigurationTestCase
{
   /**
    * Test {@link PoolConfiguration#getMinSize()}
    */
   @Test
   public void testMinSize()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(0, params.getMinSize());
      params.setMinSize(10);
      assertEquals(10, params.getMinSize());
   }

   /**
    * Test {@link PoolConfiguration#getMaxSize()}
    */
   @Test
   public void testMaxSize()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(20, params.getMaxSize());
      params.setMaxSize(30);
      assertEquals(30, params.getMaxSize());      
   }

   /**
    * Test {@link PoolConfiguration#getBlockingTimeout()}
    */
   @Test
   public void testBlockingTimeout()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(30000, params.getBlockingTimeout());
      params.setBlockingTimeout(60000);
      assertEquals(60000, params.getBlockingTimeout());
   }

   /**
    * Test {@link PoolConfiguration#getIdleTimeout()}
    */
   @Test
   public void testIdleTimeout()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertEquals(1000 * 60 * 30, params.getIdleTimeout());
      params.setIdleTimeout(1000 * 60 * 20);
      assertEquals(1000 * 60 * 20, params.getIdleTimeout());
   }

   /**
    * Test {@link PoolConfiguration#isBackgroundValidation()}
    */
   @Test
   public void testBackgroundValidation()
   {
      PoolConfiguration params = new PoolConfiguration();
      assertFalse(params.isBackgroundValidation());
      assertEquals(0L, params.getBackgroundValidationMinutes());
      assertEquals(0L, params.getBackgroundValidationInterval());

      params.setBackgroundValidation(true);
      params.setBackgroundValidationMinutes(50);

      assertTrue(params.isBackgroundValidation());
      assertEquals(50, params.getBackgroundValidationMinutes());
      assertEquals(50000L, params.getBackgroundValidationInterval());
{'fraction_non_alphanumeric': 0.10698891625615764, 'fraction_numerical': 0.025708128078817734, 'mean_word_length': 3.6909747292418773, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5222355', 'n_tokens_mistral': 1843, 'n_tokens_neox': 1720, 'n_words': 537}