/*
 * Copyright (C) 2013 Paulo Perbone. All rights reserved.
 * 
 * This file is part of JEJDBC 
 * https://github.com/perbone/jejdbc/
 *
 * JEJDBC is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * JEJDBC 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JEJDBC. If not, see <http://www.gnu.org/licenses/>.
 */

package io.perbone.jejdbc.jdbc;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;

import org.apache.log4j.BasicConfigurator;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * Driver Test Suite.
 * 
 * @author Paulo Perbone <pauloperbone@yahoo.com>
 * @since 0.1.0
 */
public class DriverTest
{
    private static final String URL_SAMPLE = "jdbc:jejdbc://localhost:5101";
    private static final String URL_SAMPLE_WRONG = "jdbc:blah://localhost:5101";
    private static final String DRIVER_CLASS_PATH = "io.perbone.jejdbc.jdbc.Driver";

    @BeforeClass
    public static void initialSetup()
    {
        BasicConfigurator.configure();
    }

    @Test
    public void loadDriver()
    {
        try
        {
            Class.forName(DRIVER_CLASS_PATH);
        }
        catch (ClassNotFoundException e)
        {
            fail(e.getMessage());
        }
    }

    @Test
    public void getDriver()
    {
        try
        {
            Driver driver = DriverManager.getDriver(URL_SAMPLE);

            assertNotNull(driver);
            assertTrue(driver.getClass().equals(io.perbone.jejdbc.jdbc.Driver.class));
        }
        catch (SQLException e)
        {
            fail(e.getMessage());
        }

        Driver driver = null;

        try
        {
            driver = DriverManager.getDriver(URL_SAMPLE_WRONG);
        }
        catch (SQLException e)
        {
            assertNull(driver);
        }
    }

    @Test
    public void testAcceptsURL()
    {
        try
        {
            Driver driver = new io.perbone.jejdbc.jdbc.Driver();

            assertTrue(driver.acceptsURL(URL_SAMPLE));
            assertFalse(driver.acceptsURL(URL_SAMPLE_WRONG));
        }
        catch (SQLException e)
        {
            fail(e.getMessage());
        }
    }
}
@@ -1,69 +1,7 @@
 /*%0A
- * Copyright (C) 2013 Paulo Perbone. All rights reserved.%0A * %0A
  * T
@@ -72,325 +72,423 @@
 /%0A *
+ 
 %0A * 
-JEJDBC is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU General Public 
+Copyright 2013-2016 Paulo Perbone%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22
 License
+%22);
 %0A * 
-as published by the Free Software Foundation; either version 2%0A * of the License, or (at your option) any later version.%0A *%0A * JEJDBC is distributed in the hope that it will be useful
+you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS
 ,%0A *
- but
  WIT
@@ -496,309 +496,176 @@
 OUT 
-ANY 
 WARRANT
-Y; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with JEJDBC. If not, see %3Chttp://www.gnu.org/l
+IES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the L
 icense
-s/%3E.
 %0A */

Fix wrong license header