/**
 * Copyright © 2012 by Data Virtuality GmbH
 */
package com.datavirtuality.dv.jdbc;

import static org.junit.jupiter.api.Assertions.*;

import java.sql.SQLException;
import java.util.Properties;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
 * @author klebeck
 *
 */
public class DriverTest {

	/**
	 * Test method for {@link com.datavirtuality.dv.jdbc.Driver#connect(java.lang.String, java.util.Properties)}.
	 */
	@Test
	@Disabled
	public void testConnect() {
		Driver test = new Driver();
		Properties props = new Properties();
		props.put("user", "user");		
		props.put("password", "user");
		try {
			test.connect("jdbc:datavirtuality:datavirtuality@mm://localhost:31000;SHOWPLAN=ON", props);
		} catch (SQLException e) {
			fail();
		}
	}

	@Test
	@Disabled
	public void testKerberosConnect() {
		System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
		System.setProperty("sun.security.jgss.native", "false");
		System.setProperty("java.security.krb5.conf", "C:/DataVirtuality/dvserver/krb5.conf");
		System.setProperty("java.security.auth.login.config", "C:/DataVirtuality/dvserver/dvclient.conf");
		System.setProperty("sun.security.krb5.debug", "true");
		System.setProperty("sun.security.krb5.principal", "user@EXAMPLE.COM");
		Driver test = new Driver();
		Properties props = new Properties();
		try {
			test.connect("jdbc:datavirtuality:datavirtuality@mm://localhost:31002;SHOWPLAN=ON;kerberosServicePrincipleName=user@EXAMPLE.COM", props);
		} catch (SQLException e) {
			fail();
		}
	}
	
	@Test
	public void testAcceptUrl() {
		Driver test = new Driver();
		try {
			test.acceptsURL("jdbc:datavirtuality:datavirtuality@mm://localhost:31000;SHOWPLAN=ON");
		} catch (SQLException e) {
			fail();
		}
	}
	

}
