<commit_before>/**
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
 * 
 * http://www.strabon.di.uoa.gr/
 */
package eu.earthobservatory.testsuite.utils;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import org.apache.commons.io.FileUtils;
import org.openrdf.query.BindingSet;
import org.openrdf.query.MalformedQueryException;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.TupleQueryResult;
import org.openrdf.query.TupleQueryResultHandlerException;
import org.openrdf.query.resultio.QueryResultIO;
import org.openrdf.query.resultio.QueryResultParseException;
import org.openrdf.query.resultio.TupleQueryResultFormat;
import org.openrdf.query.resultio.UnsupportedQueryResultFormatException;
import org.openrdf.repository.RepositoryException;
import org.openrdf.rio.RDFHandlerException;
import org.openrdf.rio.RDFParseException;
import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
import eu.earthobservatory.runtime.postgis.Strabon;
import eu.earthobservatory.utils.Format;

/**
 * A class with useful methods for the tests.
 * 
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
public class Utils
{
	private static final String dbPropertiesFile=File.separator+"databases.properties";
	private static final String prefixesFile=File.separator+"prefixes";
	
	private static String databaseTemplateName = null;
	private static String serverName = null;
	private static String username = null;
	private static String password = null;
	private static String port = null;
	
	private static Connection conn = null;
	private static String databaseName = null;
	
	private static Strabon strabon = null;
	
	public static void createdb() throws Exception
	{
		String url="";
		ArrayList<String> databases=new ArrayList<String>();
        PreparedStatement pst = null;
		
		//Read properties
		Properties properties = new Properties();
		InputStream propertiesStream =  Utils.class.getResourceAsStream(dbPropertiesFile);
		properties.load(propertiesStream);

		if((databaseTemplateName = System.getProperty("postgis.databaseTemplateName"))==null)
		{
			databaseTemplateName = properties.getProperty("postgis.databaseTemplateName");
		}
		
		if((serverName = System.getProperty("postgis.serverName"))==null)
		{<commit_msg>Again, don't spoil the fun for non Unix/Linux users.<commit_after>/**
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
 * 
 * http://www.strabon.di.uoa.gr/
 */
package eu.earthobservatory.testsuite.utils;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import org.apache.commons.io.FileUtils;
import org.openrdf.query.BindingSet;
import org.openrdf.query.MalformedQueryException;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.TupleQueryResult;
import org.openrdf.query.TupleQueryResultHandlerException;
import org.openrdf.query.resultio.QueryResultIO;
import org.openrdf.query.resultio.QueryResultParseException;
import org.openrdf.query.resultio.TupleQueryResultFormat;
import org.openrdf.query.resultio.UnsupportedQueryResultFormatException;
import org.openrdf.repository.RepositoryException;
import org.openrdf.rio.RDFHandlerException;
import org.openrdf.rio.RDFParseException;
import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
import eu.earthobservatory.runtime.postgis.Strabon;
import eu.earthobservatory.utils.Format;

/**
 * A class with useful methods for the tests.
 * 
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
public class Utils
{
	private static final String dbPropertiesFile="/databases.properties";
	private static final String prefixesFile=File.separator+"prefixes";
	
	private static String databaseTemplateName = null;
	private static String serverName = null;
	private static String username = null;
	private static String password = null;
	private static String port = null;
	
	private static Connection conn = null;
	private static String databaseName = null;
	
	private static Strabon strabon = null;
	
	public static void createdb() throws Exception
	{
		String url="";
		ArrayList<String> databases=new ArrayList<String>();
        PreparedStatement pst = null;
		
		//Read properties
		Properties properties = new Properties();
		InputStream propertiesStream =  Utils.class.getResourceAsStream(dbPropertiesFile);
		properties.load(propertiesStream);

		if((databaseTemplateName = System.getProperty("postgis.databaseTemplateName"))==null)
		{
			databaseTemplateName = properties.getProperty("postgis.databaseTemplateName");
		}
		
		if((serverName = System.getProperty("postgis.serverName"))==null)
		{
{'fraction_non_alphanumeric': 0.09896940945525928, 'fraction_numerical': 0.006543432030099787, 'mean_word_length': 5.525080042689434, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5528783', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1748, 'n_words': 440}