mssql_sdmTest.java [test/soils/db] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package soils.db;

import csip.SessionLogger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.testng.Reporter;
import soils.MapUnit;

/**
 *
 * @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
 */
public class mssql_sdmTest {

    static String CONNECTION_STRING = "";
    mssql_sdm ptrDb;
    Connection conn;
    SessionLogger Log = new SessionLogger();

    public mssql_sdmTest() {

    }

    @BeforeClass
    public static void setUpClass() {
    }

    @AfterClass
    public static void tearDownClass() {
    }

    @Before
    public void setUp() throws Exception {
        conn = createDataSource();
    }

    @After
    public void tearDown() throws SQLException {
        conn.close();
    }

    /**
     * Test of buildCHFQuery method, of class mssql_sdm.
     */
    @Test
    public void testBuildCHFQuery() throws Exception{
        System.out.println("buildCHFQuery");
        String mukey = "";
        String filter = "";
        mssql_sdm instance = new mssql_sdm(conn, Log);
        String expResult = "";
        String result = instance.buildCHFQuery(mukey, filter);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of buildCHQuery method, of class mssql_sdm.
     */
    @Test
    public void testBuildCHQuery() {
        System.out.println("buildCHQuery");
        String cokey = "";
        String filter = "";
        mssql_sdm instance = null;
        String expResult = "";
        String result = instance.buildCHQuery(cokey, filter);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of buildCSMQuery method, of class mssql_sdm.
     */
    @Test
    public void testBuildCSMQuery() {
        System.out.println("buildCSMQuery");
        MapUnit mapUnit = null;
        mssql_sdm instance = null;
        String expResult = "";
        String result = instance.buildCSMQuery(mapUnit);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of buildFindMapUnitsQuery method, of class mssql_sdm.
     */
    @Test
    public void testBuildFindMapUnitsQuery() {
        System.out.println("buildFindMapUnitsQuery");
        String WKTShape = "";
        boolean returnIntersectionShape = false;
        mssql_sdm instance = null;
        String expResult = "";
        String result = instance.buildFindMapUnitsQuery(WKTShape, returnIntersectionShape);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of buildIsConusQuery method, of class mssql_sdm.
     */
    @Test
    public void testBuildIsConusQuery() {
        System.out.println("buildIsConusQuery");
        String lat = "";
        String lon = "";
        mssql_sdm instance = null;
        String expResult = "";
        String result = instance.buildIsConusQuery(lat, lon);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of buildMinResdept_rQuery method, of class mssql_sdm.
     */
    @Test
    public void testBuildMinResdept_rQuery() {
        System.out.println("buildMinResdept_rQuery");
        String cokey = "";
        mssql_sdm instance = null;
        String expResult = "";
        String result = instance.buildMinResdept_rQuery(cokey);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of buildTextureGroupsQuery method, of class mssql_sdm.
     */
    @Test
    public void testBuildTextureGroupsQuery() {
        System.out.println("buildTextureGroupsQuery");
        String chkey = "";
        mssql_sdm instance = null;
        String expResult = "";
        String result = instance.buildTextureGroupsQuery(chkey);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of isValidDb method, of class mssql_sdm.
     */
    @Test
    public void testIsValidDb() {
        System.out.println("isValidDb");
        mssql_sdm instance = null;
        boolean expResult = false;
        boolean result = instance.isValidDb();
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of findComponentsForMapUnit method, of class mssql_sdm.
     */
    @Test
    public void testFindComponentsForMapUnit() throws Exception {
        System.out.println("findComponentsForMapUnit");
        MapUnit mapUnit = null;
        mssql_sdm instance = null;
        boolean expResult = false;
        boolean result = instance.findComponentsForMapUnit(mapUnit);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of findComponentsForMukey method, of class mssql_sdm.
     */
    @Test
    public void testFindComponentsForMukey() throws Exception {
        System.out.println("findComponentsForMukey");
        String mukey = "";
        mssql_sdm instance = null;
        MapUnit expResult = null;
        MapUnit result = instance.findComponentsForMukey(mukey);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    private static synchronized Connection createDataSource() throws Exception {
        System.out.println("Loading the SDMDriver, and testing a connection.");
        Class.forName("csip.sdm.SDMDriver");
        Reporter.log("Driver was loaded for: csip.sdm.SDMDriver");
        Connection conn = DriverManager.getConnection("jdbc:sdm:rest://SDMDataAccess.sc.egov.usda.gov/Tabular/post.rest");
        Reporter.log("Connection to remote SDM REST Service was successful");

        return conn;
    }
}