package org.umlg.sqlg.test.tp3;

import org.apache.tinkerpop.gremlin.LoadGraphWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.umlg.sqlg.HsqldbPlugin;
import org.umlg.sqlg.SqlgPlugin;
import org.umlg.sqlg.structure.SqlgGraph;

import java.util.HashMap;
import java.util.Map;

/**
 * Date: 2014/07/13
 * Time: 5:57 PM
 */
public class SqlgHsqldbProvider extends SqlgAbstractGraphProvider {

    private Logger logger = LoggerFactory.getLogger(SqlgHsqldbProvider.class.getName());

    @Override
    public Map<String, Object> getBaseConfiguration(String graphName, Class<?> test, String testMethodName, LoadGraphWith.GraphData loadGraphWith) {
        logger.info("Hsqldb, Starting test: " + test.getSimpleName() + "." + testMethodName);
        return new HashMap<String, Object>() {{
            put("gremlin.graph", SqlgGraph.class.getName());
            put("jdbc.url", "jdbc:hsqldb:file:src/test/db/" + graphName + "");
            put("jdbc.username", "SA");
            put("jdbc.password", "");
        }};
    }

    @Override
    public SqlgPlugin getSqlgPlugin() {
        return new HsqldbPlugin();
    }
}

@@ -48,39 +48,212 @@
 che.
-tinkerpop.gremlin.LoadGraphWith
+commons.configuration.Configuration;%0Aimport org.apache.tinkerpop.gremlin.LoadGraphWith;%0Aimport org.apache.tinkerpop.gremlin.structure.Graph;%0Aimport org.apache.tinkerpop.gremlin.structure.util.GraphFactory
 ;%0Aim
@@ -418,16 +418,101 @@
 Graph;%0A%0A
+import java.sql.Connection;%0Aimport java.sql.SQLException;%0Aimport java.sql.Statement;%0A
 import j
@@ -682,21 +682,34 @@
 ate 
+final static 
 Logger 
-logger
+LOGGER
  = L
@@ -944,14 +944,14 @@
     
-logger
+LOGGER
 .inf
@@ -1288,24 +1288,24 @@
 word%22, %22%22);%0A
-
         %7D%7D;%0A
@@ -1311,16 +1311,530 @@
 %0A    %7D%0A%0A
+    @Override%0A    public Graph openTestGraph(final Configuration config) %7B%0A        SqlgGraph sqlgGraph = (SqlgGraph)GraphFactory.open(config);%0A        try %7B%0A            Connection connection = sqlgGraph.tx().getConnection();%0A            Statement statement = connection.createStatement();%0A            statement.execute(%22SET DATABASE SQL AVG SCALE 2%22);%0A            sqlgGraph.tx().commit();%0A            return sqlgGraph;%0A        %7D catch (SQLException e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A    %7D%0A%0A
     @Ove

set hsqldb's average decimal places