Filed under: Uncategorized
JUnit test will INITIALIZE (but try nothing) if you have:
1. The TestSetup class
2. The db.properties resource
It will TRY to connect to Ingres (but skip the tests) if you have:
3. The Ingres JDBC drivers downloaded.
4. The JDBC drivers referenced in pom.xml
5. The JDBC drivers referenced by db.properties’ Driver field.
It will connect to Ingres and FAIL the tests if you have:
6. An Ingres instance running
7. db.properties contain relevant and correct connection information
(address and protocol type, username, password)
It will PASS the tests if you have:
8. Ingres instance SUPPORTS Geospatial datatypes.
9. Unit tests logic are correct.
10. Source implementations are correct.
————–
Is it just running “mvn test" that causes the tests to run?
mvn install compiles then runs the tests
——————-
Make sure you read more carefully the error messages from mvn, I had
the same problem building after I added the dependency tag into
pom.xml. But turns out its because I was not careful with the xml
tags.
After some fixing it works. So to confirm here’s the last few lines of
my pom.xml:
</developers>
<dependencies>
<dependency>
<groupId>com.ingres.jdbc</
<artifactId>iijdbc</artifactId>
<version>9.2-3.4.9</version>
</dependency>
</dependencies>
</project>
Anthony, to answer your question in the previous email. I believe
theoretically that AS LONG AS we don’t change jdbc-ng/pom.xml to add
that line referencing its subfolder, we will never break the build
anyways, so should’ve been unnecessary to run mvn install from the
trunk. However, past experiences tell me to still run it once to show
due diligence on ensuring no surprises. And since we should always svn
update before svn commit, running mvn install after update is the only
way to confirm that our change and someone else’s change do not
conflict.
Filed under: Uncategorized
This part is based on the test classes for PostGIS
PostGISTestSetup needs PostGISDialect which extends BasicSQLDialect
so do we need IngresDialect?
notice it also needs PostGISNGDataStoreFactory
Filed under: Uncategorized
This part is based on the test suite for DB2. According the class usage from test classes, we need to have the following classes (name in bold is the test class name)
DB2TestSetup
IngresUtil
IngresTestUtil
IngresNGDataStoreFactory
JDBCDataStoreTest: research again
JDBCSpatialFiltersTest
IngresDataStore
Other test classes don’t require any other jdbc classes other than those mentioned above
Filed under: Uncategorized
This is just roadmap of further studying
DB2SQLDialect vs. OracleSQLDialect
DB2SQLDialect extends SQLDialect
OracleDialect extends PreparedStatementSQLDialect
DB2FilterToSQL vs. OracleFilterToSQL
1.createFilterCapabilities()
instantitated different capabilities
2.visitBinarySpatialOperator()
DB2:visitBinarySpatialOperator(BinarySpatialOperator filter, Object extraData, String db2Predicate)
Oracle:
visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property,
Literal geometry, boolean swapped, Object extraData)
OracleNGDataStoreFactory vs. OracleNGDataStoreFactory
1.createDataStoreInternal(JDBCDataStore dataStore, Map params)
Oracle:
// make the schema uppercase if it’s not already
if(dataStore.getDatabaseSchema() != null)
dataStore.setDatabaseSchema(dataStore.getDatabaseSchema().toUpperCase());
// setup loose bbox
OracleDialect dialect = (OracleDialect) dataStore.getSQLDialect();
Boolean loose = (Boolean) LOOSEBBOX.lookUp(params);
dialect.setLooseBBOXEnabled(loose == null || Boolean.TRUE.equals(loose));
// setup proper fetch size
dataStore.setFetchSize(200);
DB2:
try {
con = dataStore.getDataSource().getConnection();
DatabaseMetaData md = con.getMetaData();
MajorVersion=md.getDatabaseMajorVersion();
MinorVersion=md.getDatabaseMinorVersion();
ProductName=md.getDatabaseProductName();
ProductVersion=md.getDatabaseProductVersion();
} catch (SQLException e) {
throw new IOException(e.getMessage());
}
dataStore.closeSafe(con);
2.getJDBCUrl
Oracle
String host = (String) HOST.lookUp(params);
String db = (String) DATABASE.lookUp(params);
int port = (Integer) PORT.lookUp(params);
if( db.startsWith(“(“) )
return JDBC_PATH + db;
else if( db.startsWith(“/”) )
return JDBC_PATH + “//” + host + “:” + port + db;
else
return JDBC_PATH + host + “:” + port + “:” + db;
DB2:
String host=null;
Integer port = null;
try {
host = (String) HOST.lookUp(params);
port = (Integer) PORT.lookUp(params);
} catch (IOException ex) {
// do nothing
}
String db = (String) DATABASE.lookUp(params);
if (host==null && port== null && db !=null)
return “jdbc:”+getDatabaseID()+”:”+db;
return super.getJDBCUrl(params);
3. setupParameters(Map parameters)
Oracle:
// NOTE: when adding parameters here remember to add them to OracleNGOCIDataStoreFactory and
// OracleNGJNDIDataStoreFactory
super.setupParameters(parameters);
parameters.put(LOOSEBBOX.key, LOOSEBBOX);
parameters.put(MAX_OPEN_PREPARED_STATEMENTS.key, MAX_OPEN_PREPARED_STATEMENTS);
parameters.put(PORT.key, PORT);
parameters.put(DBTYPE.key, DBTYPE);
DB2:
super.setupParameters(parameters);
parameters.put(DBTYPE.key, DBTYPE);
4.getValidationQuery()
Oracle:
“select sysdate from dual”
DB2:
“select current date from sysibm.sysdummy1″;
OracleNGJNDIDataStoreFactory vs. DB2NGJNDIDataStoreFactory
Constructor
Oracle:
super.setupParameters(parameters);
parameters.put(OracleNGDataStoreFactory.LOOSEBBOX.key, OracleNGDataStoreFactory.LOOSEBBOX);
parameters.put(MAX_OPEN_PREPARED_STATEMENTS.key, MAX_OPEN_PREPARED_STATEMENTS);
DB2:
super(new DB2NGDataStoreFactory());
Filed under: Uncategorized
http://community.ingres.com/wiki/IngresGeoTools
all technical decisions or findings captured in the wiki written as though a perfect stranger may need to pick them up in a year or two. Ensuring this is done very well, demonstrating the high quality of work and professionalism is the foundation to me going after approval to hire one or possibly more of the team. The schedule component should look a little like this please: http://community.ingres.com/wiki/GeoProjectPlan P
—————–
- abstract jdbc tests located here: http://svn.osgeo.org/geotools/branches/2.6.x/modules/library/jdbc/src/test/java/org/geotools/jdbc
- our subclass tests will be located here: http://svn.osgeo.org/geotools/branches/2.6.x/modules/unsupported/jdbc/jdbc-ingres/src/test/java/org/geotools/data/ingres (at least one per class).
- our code should be under “unsupported” for now
- some databases (i.e. postgis) have implementations with options for both plain sql as well as prepared statments. What about ingres?
- openGeo stack workshop: http://workshops.opengeo.org/stack-intro/
——————————
- abstract jdbc tests located here: http://svn.osgeo.org/geotools/branches/2.6.x/modules/library/jdbc/src/test/java/org/geotools/jdbc
- our subclass tests will be located here: http://svn.osgeo.org/geotools/branches/2.6.x/modules/unsupported/jdbc/jdbc-ingres/src/test/java/org/geotools/data/ingres (at least one per class).
- our code should be under “unsupported” for now
- some databases (i.e. postgis) have implementations with options for both plain sql as well as prepared statments. What about ingres?
- openGeo stack workshop: http://workshops.opengeo.org/stack-intro/
—————————-
Prerequisites:
First, make sure you have all the following installed properly.
Maven (with Jetty plug-in, should be shipped together by default, but if not just download seperately)
JDK (you know how to install JDK I hope, except to avoid wierd behaviour, please make sure your full path is contains no space in it, this goes for other software as well hopefully)
svn(to make sure you’re able to check out source code)
Also make sure you have all the following in your command line environment.
M2_HOME=<directory-to-maven>
JAVA_HOME=<directory-to-JDK>
PATH=%PATH%;%M2_HOME%/bin;%JAVA_HOME%/bin
Steps:
Compile and setup with Maven:
mkdir everythingInsideHere
cd everythingInsideHere
mkdir svn
cd svn
svn co https://svn.codehaus.org/geoserver/trunk geoserver
svn co https://svn.osgeo.org/geotools/trunk geotools
cd geoserver/src
mvn install
mvn eclipse:eclipse
cd ../../geotools
mvn install
mvn eclipse:eclipse
Setup Eclipse:
Run Eclipse into an empty workspace.
Go to Window->Preferences
Under Java->BuildPath->Classpath Variable (or just type classpath variables in the filter search box), make sure an M2_REPO variable is set. If not, click on “New…” and under “Name” type M2_REPO, under “Path” point it to your .m2/repository folder. (For windows, it should be in your username folder)
Under Java->Compiler->Building, make sure .svn is included in the “Filtered resources” field.
Click on OK to close the Preferences window.
Now under the Package Explorer on the left, right click in the empty space and find the Import… menu, click on it.
Select “Existing Projects into Workspace” and click Next
Select root directory to be the exact same directory where you invoked mvn install in your geoserver/src. That should list out a LOT of projects after a long search. Add all of them into eclipse. They should show up in the originally empty Package Explorer, one of which is called “web-app”. Eclipse should automatically build all your project and hopefully there should be no errors.
You need to setup maven jetty to be run as an external tool though. So click on Run->External Tools->External Tools Configuration
Under Program, create a New_configuration if there’s not already an empty one created for you, then the “Main” and “Environment” needs to be setup as follow:
Main
Location: <the actual mvn binary file on your file system, e.g. for Windows its %M2_HOME%/bin/mvn.bat>
Working Directory: Click on “Browse Workspace” and select the web-app project.
Arguments: jetty:run
Environment
Click on “New…” and add the following into the environment variables to set:
Variable: MAVEN_OPTS
Value: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8080,server=y,suspend=y
After that you could click apply and ok to close this window (or “RUN” if you want to run immediately)
Invoke Debug instance:
Now you can begin debugging. Run the External Tool configuration you’ve created if you haven’t.
Go to Run->Debug Configurations…
Under “Remote Java Application”, create a new configuration just like you did for External Tool, this time with the following:
Connect
Project: web-app
Connection Type: Standard(Socket Attach)
Connection Properties:
Host: localhost
Port: 8080
CHECK Allow termination of remote VM.
Click Apply, and click Debug
Wait for a while, if all else works out, you should be able to open your browser and go to http://localhost:8080/geoserver/ and get greeted by an instance of Geoserver!
Filed under: Uncategorized
the testing can be broken down into three parts:
1. the JUnit tests
2. the entire application stack (i.e. OpenGeo)
3. programmatically debugging using GeoServer
————————-
The breakpoints to PostgisNGDataStoreFactory also got hit and hence I
also confirmed that its using a
.m2/repository/gt-jdbc-2.7-
such a jar file, I can REPLACE that SOURCE-ATTACHED jar file for
debugging!