package org.cru.godtools.domain;

import com.googlecode.flyway.core.Flyway;
import com.googlecode.flyway.core.api.MigrationVersion;

/**
 * Created by ryancarlson on 4/1/14.
 */
public class UnittestDatabaseBuilder
{
	public static void main(String[] args)
	{
		new UnittestDatabaseBuilder().build();
	}

	public void build()
	{
		Flyway flyway = new Flyway();
		flyway.setDataSource("jdbc:postgresql://localhost/godtoolstest", "godtoolsuser", "godtoolsuser");
		flyway.setInitVersion("0");
		flyway.setTarget(MigrationVersion.fromVersion("0.3"));
		flyway.clean();
		flyway.init();
		flyway.migrate();
	}
}

@@ -124,16 +124,147 @@
 Version;
+%0Aimport org.cru.godtools.domain.properties.GodToolsProperties;%0Aimport org.cru.godtools.domain.properties.GodToolsPropertiesFactory;
 %0A%0A/**%0A *
@@ -341,16 +341,96 @@
 ilder%0A%7B%0A
+%09static GodToolsProperties properties = new GodToolsPropertiesFactory().get();%0A%0A
 %09public 
@@ -592,82 +592,165 @@
 rce(
-%22jdbc:postgresql://localhost/godtoolstest%22, %22godtoolsuser%22, %22godtoolsuser%22
+properties.getProperty(%22unittestDatabaseUrl%22),%0A%09%09%09%09properties.getProperty(%22unittestDatabaseUsername%22),%0A%09%09%09%09properties.getProperty(%22unittestDatabasePassword%22)
 );%0A%09

Remove hardcoded database info, use properties