TestDriverLoad.java [test] Revision: aec0ee9401db8dd200a03a888ea4b9dcb1f6fd61 Date: Thu Jul 20 10:44:56 MDT 2017
/*
* 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.
*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import static org.testng.Assert.*;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
/**
*
* @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
*/
public class TestDriverLoad {
public TestDriverLoad() throws ClassNotFoundException, SQLException {
Class.forName("org.csu.csip.sdm.SDMDriver");
Connection conn = DriverManager.getConnection("jdbc:sdm:rest://SDMDataAccess.sc.egov.usda.gov/Tabular/post.rest");
Statement statement = conn.createStatement();
ResultSet results = statement.executeQuery("SELECT areasymbol, musym, mukey, muname, muacres, brockdepmin, geography::STGeomFromText(intersectPoly.STAsText(), 4326).MakeValid().STArea() / 4046.86 AS area FROM (SELECT m.areasymbol, m.musym, m.mukey, mapunit.muacres, mapunit.muname, muaggatt.brockdepmin, m.mupolygongeo.STIntersection(geometry::STGeomFromText ('POLYGON ((-72.54863 42.4476, -72.54835 42.44746, -72.54756 42.44709, -72.54863 42.44709, -72.54863 42.4476))', 4326)).MakeValid() as intersectPoly FROM dbo.mupolygon as m WITH (index(SI_mupolygon_24876)) INNER JOIN dbo.mapunit ON m.mukey=dbo.mapunit.mukey INNER JOIN dbo.legend ON mapunit.lkey=dbo.legend.lkey INNER JOIN dbo.muaggatt ON m.mukey=dbo.muaggatt.mukey WHERE m.mupolygongeo.STIntersects(geometry::STGeomFromText ('POLYGON ((-72.54863 42.4476, -72.54835 42.44746, -72.54756 42.44709, -72.54863 42.44709, -72.54863 42.4476))', 4326)) = 1 AND m.mupolygongeo.STIsValid()=1 AND (geometry:: STGeomFromText ('POLYGON ((-72.54863 42.4476, -72.54835 42.44746, -72.54756 42.44709, -72.54863 42.44709, -72.54863 42.4476))', 4326).STIsValid())=1 AND legend.areatypename like 'Non-MLRA%' ) as a ORDER BY mukey;");
}
// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
//
// @Test
// public void hello() {}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@BeforeMethod
public void setUpMethod() throws Exception {
}
@AfterMethod
public void tearDownMethod() throws Exception {
}
}