From 41775a9e86e6796a130d0f6865921a370ee8cf7b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sat, 6 May 2023 21:09:38 +0200 Subject: [PATCH] [DEV]try to manage create db --- back/.classpath | 21 ++----------------- back/src/org/kar/karso/WebLauncherLocal.java | 5 +++++ back/test/src/test/kar/karso/TestBase.java | 15 ++++++++++++- .../src/test/kar/karso/WebLauncherTest.java | 15 ++++++++++--- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/back/.classpath b/back/.classpath index f08c943..be01af4 100644 --- a/back/.classpath +++ b/back/.classpath @@ -1,6 +1,6 @@ - + @@ -13,7 +13,7 @@ - + @@ -30,22 +30,5 @@ - - - - - - - - - - - - - - - - - diff --git a/back/src/org/kar/karso/WebLauncherLocal.java b/back/src/org/kar/karso/WebLauncherLocal.java index 6e3f473..1ccaba9 100755 --- a/back/src/org/kar/karso/WebLauncherLocal.java +++ b/back/src/org/kar/karso/WebLauncherLocal.java @@ -1,6 +1,11 @@ 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.karso.util.ConfigVariable; import org.slf4j.Logger; diff --git a/back/test/src/test/kar/karso/TestBase.java b/back/test/src/test/kar/karso/TestBase.java index 7889b2e..6bdb8fe 100644 --- a/back/test/src/test/kar/karso/TestBase.java +++ b/back/test/src/test/kar/karso/TestBase.java @@ -1,4 +1,7 @@ package test.kar.karso; +import java.io.IOException; +import java.sql.PreparedStatement; +import java.sql.ResultSet; import java.util.Map; 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.ExtensionContext; 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.model.GetToken; import org.kar.archidata.util.ConfigBaseVariable; @@ -52,7 +58,14 @@ public class TestBase { logger.info("configure server ..."); webInterface = new WebLauncherTest(); 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)"); webInterface.process(); logger.info("Start REST (DONE)"); diff --git a/back/test/src/test/kar/karso/WebLauncherTest.java b/back/test/src/test/kar/karso/WebLauncherTest.java index 3d1c4f1..e54425c 100755 --- a/back/test/src/test/kar/karso/WebLauncherTest.java +++ b/back/test/src/test/kar/karso/WebLauncherTest.java @@ -13,13 +13,22 @@ public class WebLauncherTest extends WebLauncher { logger.debug("Configure REST system"); // for local test: ConfigBaseVariable.apiAdress = "http://127.0.0.1:12345/test/api/"; + ConfigBaseVariable.dbPort = "3306"; // create a unique key for test ==> not retrieve the token every load... ConfigVariable.uuid_for_key_generation = "lkjlkjlkjlmkjqmwlsdkjqfsdlkf,nmQLSDK,NFMQLKSdjmlKQJSDMLQK,S;ndmLQKZNERMA,ÉL"; // for the test we a in memory sqlite.. - ConfigBaseVariable.dbType = "sqlite"; - ConfigBaseVariable.dbHost = "memory"; + ////ConfigBaseVariable.dbType = "sqlite"; + ////ConfigBaseVariable.dbHost = "memory"; // 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 = ""; + } }