[DEV]try to manage create db

This commit is contained in:
Edouard DUPIN 2023-05-06 21:09:38 +02:00
parent 03522c9f64
commit 41775a9e86
4 changed files with 33 additions and 23 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src"> <classpathentry kind="src" output="out/maven/classes" path="src">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
@ -13,7 +13,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -30,22 +30,5 @@
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" path="out/maven/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="out/maven/test-classes" path="out/maven/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="out/maven/classes"/> <classpathentry kind="output" path="out/maven/classes"/>
</classpath> </classpath>

View File

@ -1,6 +1,11 @@
package org.kar.karso; package org.kar.karso;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.kar.archidata.GlobalConfiguration;
import org.kar.archidata.db.DBEntry;
import org.kar.archidata.util.ConfigBaseVariable; import org.kar.archidata.util.ConfigBaseVariable;
import org.kar.karso.util.ConfigVariable; import org.kar.karso.util.ConfigVariable;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@ -1,4 +1,7 @@
package test.kar.karso; package test.kar.karso;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Map; import java.util.Map;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
@ -13,6 +16,9 @@ import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler; import org.junit.jupiter.api.extension.TestExecutionExceptionHandler;
import org.kar.archidata.GlobalConfiguration;
import org.kar.archidata.SqlWrapper;
import org.kar.archidata.db.DBEntry;
import org.kar.archidata.exception.RESTErrorResponseExeption; import org.kar.archidata.exception.RESTErrorResponseExeption;
import org.kar.archidata.model.GetToken; import org.kar.archidata.model.GetToken;
import org.kar.archidata.util.ConfigBaseVariable; import org.kar.archidata.util.ConfigBaseVariable;
@ -52,7 +58,14 @@ public class TestBase {
logger.info("configure server ..."); logger.info("configure server ...");
webInterface = new WebLauncherTest(); webInterface = new WebLauncherTest();
logger.info("Create DB"); logger.info("Create DB");
webInterface.generateDB();
String dbName = "qsqsdqsdqsdqsd";
boolean data = SqlWrapper.isDBExist(dbName);
logger.error(" - {}", data);
data = SqlWrapper.createDB(dbName);
logger.error(" - {}", data);
System.exit(-1);
logger.info("Start REST (BEGIN)"); logger.info("Start REST (BEGIN)");
webInterface.process(); webInterface.process();
logger.info("Start REST (DONE)"); logger.info("Start REST (DONE)");

View File

@ -13,13 +13,22 @@ public class WebLauncherTest extends WebLauncher {
logger.debug("Configure REST system"); logger.debug("Configure REST system");
// for local test: // for local test:
ConfigBaseVariable.apiAdress = "http://127.0.0.1:12345/test/api/"; ConfigBaseVariable.apiAdress = "http://127.0.0.1:12345/test/api/";
ConfigBaseVariable.dbPort = "3306"; ConfigBaseVariable.dbPort = "3306";
// create a unique key for test ==> not retrieve the token every load... // create a unique key for test ==> not retrieve the token every load...
ConfigVariable.uuid_for_key_generation = "lkjlkjlkjlmkjqmwlsdkjqfsdlkf,nmQLSDK,NFMQLKSdjmlKQJSDMLQK,S;ndmLQKZNERMA,ÉL"; ConfigVariable.uuid_for_key_generation = "lkjlkjlkjlmkjqmwlsdkjqfsdlkf,nmQLSDK,NFMQLKSdjmlKQJSDMLQK,S;ndmLQKZNERMA,ÉL";
// for the test we a in memory sqlite.. // for the test we a in memory sqlite..
ConfigBaseVariable.dbType = "sqlite"; ////ConfigBaseVariable.dbType = "sqlite";
ConfigBaseVariable.dbHost = "memory"; ////ConfigBaseVariable.dbHost = "memory";
// for test we need to connect all time the DB // for test we need to connect all time the DB
ConfigBaseVariable.dbKeepConnected = "true"; ////ConfigBaseVariable.dbKeepConnected = "true";
ConfigBaseVariable.dbHost = "192.168.14.100";
ConfigBaseVariable.dbPort = "20006";
ConfigBaseVariable.dbUser = "root";
ConfigBaseVariable.dbPassword = "password";
ConfigBaseVariable.bdDatabase = "";
} }
} }