Skip to content

Commit 8a50df2

Browse files
authored
Add support to GXtest Mockup (#539)
* Add support to GXtest Mockup Issue:94887 * Add support to GXtest Mockup Issue:94887 * Add support to GXtest Mockup Issue:94887
1 parent 2c56fa8 commit 8a50df2

28 files changed

+918
-40
lines changed

java/CloudServices.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Services>
3+
<Service>
4+
<Name>GXTEST</Name>
5+
<Type>DataAccess</Type>
6+
<ClassName>com.genexus.db.driver.GXDBMSGxTest</ClassName>
7+
</Service>
8+
</Services>

java/client.cfg

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
[Client]
2+
MODEL_NUM= 2
3+
GENERATOR_NUM= 12
4+
LOGIN_AS_USERID=0
5+
SMTP_HOST=
6+
NAME_SPACE= com.mockdb
7+
NAME_HOST=
8+
CORBA_SERVER_NAME=
9+
DCOM_GUID=
10+
CONN_TIMEOUT=300
11+
HELP_MODE=WINHTML
12+
HELP_BASEURL=
13+
PREFERRED_UI=BEST
14+
JFC_LF=NATIVE
15+
CALENDAR=1
16+
CALC=1
17+
WP_RESIZE=1
18+
SHOW_STATUS=1
19+
FIELD_EXIT=Tab
20+
ESCAPE_FUNCTION=Exit_form
21+
KEY_REFRESH=5
22+
KEY_PROMPT=4
23+
MDI_FORMS=1
24+
REMOTE_CALLS=NEVER
25+
IMAGE_SUBST=0
26+
CS_CONNECT=First
27+
CS_REORG=1
28+
CS_REORGJAVA=1
29+
SUBFILE_ORDER=Y
30+
FC_READONLY=GRAYED
31+
PACKAGE=com.mockdb
32+
DECIMAL_POINT=.
33+
DATE_FMT= DMY
34+
CTOD_DATE_FMT= L
35+
BLANK_EMPTY_DATE=0
36+
TIME_FMT=12
37+
YEAR_LIMIT=40
38+
COMPRESS_HTML=1
39+
DocumentType=HTML5
40+
IE_COMPATIBILITY_VIEW=EmulateIE7
41+
EXPOSE_METADATA= 0
42+
WEB_IMAGE_DIR=/static
43+
HTTP_BACKEND_URL=
44+
WEB_STATIC_DIR=
45+
ORQ_CLIENT_URL=
46+
ORQ_SERVER_DIR=
47+
TMPMEDIA_DIR=PrivateTempStorage
48+
PRINT_LAYOUT_METADATA_DIR=LayoutMetadata
49+
HTTP_PROTOCOL=Unsecure
50+
SAMESITE_COOKIE=Lax
51+
StorageTimeZone= 1
52+
GX_BUILD_NUMBER=17233991
53+
ODBC_CALLS=0
54+
NameSpace1= com.mockdb
55+
LANGUAGE=German
56+
LANG_NAME=German
57+
Theme=Carmine
58+
CS_BLOB_PATH=PublicTempStorage
59+
SUBMIT_POOL_SIZE=5
60+
CACHE_TTL_0=-1
61+
CACHE_TTL_1=60
62+
CACHE_TTL_2=600
63+
CACHE_TTL_3=0
64+
CACHE_STORAGE_SIZE=0
65+
CACHING=0
66+
SMART_CACHING=0
67+
CACHE_INVALIDATION_TOKEN=202231018204023
68+
EVENT_BEFORE_COMMIT=
69+
EVENT_AFTER_COMMIT=
70+
EVENT_BEFORE_ROLLBACK=
71+
EVENT_AFTER_ROLLBACK=
72+
EVENT_BEFORE_CONNECT=
73+
EVENT_AFTER_CONNECT=
74+
ENABLE_MANAGEMENT=0
75+
EnableIntegratedSecurity=0
76+
IntegratedSecurityLoginWeb=
77+
IntegratedSecurityNotAuthorizedWeb=
78+
HTTPCLIENT_MAX_SIZE=1000
79+
HTTPCLIENT_MAX_PER_ROUTE=1000
80+
VER_STAMP=20220103.214234
81+
[language|English]
82+
code= eng
83+
time_fmt= 12
84+
decimal_point= .
85+
thousand_sep= ,
86+
date_fmt= MDY
87+
culture= en-US
88+
[language|German]
89+
code= German
90+
time_fmt= 12
91+
decimal_point= .
92+
thousand_sep= ,
93+
date_fmt= DMY
94+
culture= de-DE
95+
[language|TraditionalChinese]
96+
code= cht
97+
time_fmt= 24
98+
decimal_point= .
99+
thousand_sep= ,
100+
date_fmt= YMD
101+
culture= zh-TW
102+
[language|SimplifiedChinese]
103+
code= chs
104+
time_fmt= 24
105+
decimal_point= .
106+
thousand_sep= ,
107+
date_fmt= YMD
108+
culture= zh-CN
109+
[language|Spanish]
110+
code= spa
111+
time_fmt= 24
112+
decimal_point= ,
113+
thousand_sep= .
114+
date_fmt= DMY
115+
culture= es-ES
116+
[language|Japanese]
117+
code= jap
118+
time_fmt= 24
119+
decimal_point= .
120+
thousand_sep= ,
121+
date_fmt= YMD
122+
culture= ja-JP
123+
[language|Portuguese]
124+
code= por
125+
time_fmt= 24
126+
decimal_point= ,
127+
thousand_sep= .
128+
date_fmt= DMY
129+
culture= pt-BR
130+
[language|Italian]
131+
code= ita
132+
time_fmt= 24
133+
decimal_point= ,
134+
thousand_sep= .
135+
date_fmt= DMY
136+
culture= it-IT
137+
[language|Arabic]
138+
code= Arabic
139+
time_fmt= 24
140+
decimal_point= ,
141+
thousand_sep= .
142+
date_fmt= DMY
143+
culture= ar-SA
144+
[com.mockdb]
145+
GXDB_LOCATION=
146+
JTA=0
147+
DataSource1=DEFAULT
148+
JDBC_LOG= c:\temp\UTL.log
149+
JDBCLogEnabled=1
150+
JDBCUniqueName=0
151+
JDBCLogPath=
152+
JDBCLogLevel=0
153+
JDBCLogBuffer=0
154+
JDBCLogDetail=0
155+
[com.mockdb|DEFAULT]
156+
CS_DBNAME=
157+
INFORMIX_DB=ANSI
158+
CS_LIBL400=
159+
CS_PACKAGE400=
160+
DB2400_DATE_DATATYPE=
161+
CS_SCHEMA=
162+
USER_ID=G8xdg8k/gK9eOCDgU75tkr==
163+
USER_PASSWORD=4gPZ5cDtMVud7diJ/gIVrg==
164+
CS_CONNECT=First
165+
WAIT_RECORD=0
166+
LOCK_RETRY=10
167+
LoginInServer=1
168+
JDBC_DRIVER=org.sqlite.JDBC
169+
DB_URL=jdbc:sqlite:sample.db
170+
USE_JDBC_DATASOURCE=0
171+
JDBC_DATASOURCE=
172+
MAX_CURSOR=100
173+
INITIALIZE_NEW=1
174+
ISOLATION_LEVEL=CR
175+
XBASE_TINT=1
176+
DBMS=sqlserver
177+
UnlimitedRWPool=1
178+
PoolRWEnabled=1
179+
RecycleRW=1
180+
RecycleRWType=1
181+
RecycleRWMin=30
182+
POOLSIZE_RW=10
183+
POOL_STARTUP=0

java/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@
255255
<version>3.0.0</version>
256256
</dependency>
257257
<dependency>
258+
<groupId>org.xerial</groupId>
259+
<artifactId>sqlite-jdbc</artifactId>
260+
<version>3.36.0.3</version>
261+
</dependency>
262+
<dependency>
258263
<groupId>com.microsoft.sqlserver</groupId>
259264
<artifactId>mssql-jdbc</artifactId>
260265
<version>10.2.0.jre8</version>

java/sample.db

8 KB
Binary file not shown.

java/src/main/java/com/genexus/db/driver/DataSource.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
import java.util.Enumeration;
55
import java.util.Hashtable;
66

7+
import com.genexus.Application;
78
import com.genexus.common.classes.AbstractDataSource;
9+
import com.genexus.diagnostics.core.ILogger;
10+
import com.genexus.diagnostics.core.LogManager;
11+
import com.genexus.util.GXService;
12+
import com.genexus.util.GXServices;
813

914
public class DataSource extends AbstractDataSource
1015
{
16+
public static final ILogger logger = LogManager.getLogger(DataSource.class);
1117
public static String INFORMIX_DB_ANSI = "ANSI";
1218
public static String INFORMIX_DB_LOGGED = "Logged";
1319
public static String INFORMIX_DB_NOTLOGGED = "NotLogged";
@@ -310,6 +316,20 @@ private void setDBMS(String dbmsName)
310316
{
311317
throw new InternalError("Unrecognized DBMS in configuration file : " + dbmsName + " / " + className);
312318
}
319+
GXService providerService = Application.getGXServices().get(GXServices.DATA_ACCESS_SERVICE);
320+
if (providerService != null)
321+
{
322+
String providerClassName = providerService.getClassName();
323+
try
324+
{
325+
logger.info("Loading providerService:" + providerClassName);
326+
dbms = (GXDBMS) Class.forName(providerClassName).getConstructor(new Class[] {GXDBMS.class}).newInstance(new Object[] {dbms});
327+
}
328+
catch(Exception ex)
329+
{
330+
logger.error("Couldn't create DATA_ACCESS_PROVIDER as : " + providerClassName, ex);
331+
}
332+
}
313333
}
314334

315335
public synchronized IConnectionPool getConnectionPool()

java/src/main/java/com/genexus/db/driver/GXCallableStatement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public boolean execute() throws SQLException
5454
log(GXDBDebug.LOG_MIN, "Executing callable statement");
5555
try
5656
{
57-
ret = stmt.execute();
57+
ret = con.getDBMS().execute(stmt);
5858
log(GXDBDebug.LOG_MIN, "succesfully executed");
5959
}
6060
catch (SQLException sqlException)
@@ -65,7 +65,7 @@ public boolean execute() throws SQLException
6565
}
6666
else
6767
{
68-
ret = stmt.execute();
68+
ret = con.getDBMS().execute(stmt);
6969
}
7070

7171
//con.setNotInUse(this);

java/src/main/java/com/genexus/db/driver/GXDBMS.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.sql.Connection;
44
import java.sql.PreparedStatement;
5+
import java.sql.Statement;
56
import java.sql.ResultSet;
67
import java.sql.SQLException;
78

@@ -44,6 +45,9 @@ public interface GXDBMS
4445
void commit(Connection con) throws SQLException;
4546
void rollback(Connection con) throws SQLException;
4647
ResultSet executeQuery(PreparedStatement stmt, boolean hold) throws SQLException;
48+
int executeUpdate(PreparedStatement stmt) throws SQLException;
49+
boolean execute(PreparedStatement stmt) throws SQLException;
50+
int[] executeBatch(Statement stmt) throws SQLException;
4751

4852
void setDatabaseName(String dbName);
4953
String getDatabaseName();

java/src/main/java/com/genexus/db/driver/GXDBMSaccess.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.genexus.db.driver;
22

3-
import java.sql.Connection;
4-
import java.sql.PreparedStatement;
5-
import java.sql.ResultSet;
6-
import java.sql.SQLException;
3+
import java.sql.*;
74
import java.util.Date;
85

96
import com.genexus.CommonUtil;
@@ -15,6 +12,21 @@ public ResultSet executeQuery(PreparedStatement stmt, boolean hold) throws SQLEx
1512
return stmt.executeQuery();
1613
}
1714

15+
public int executeUpdate(PreparedStatement stmt) throws SQLException
16+
{
17+
return stmt.executeUpdate();
18+
}
19+
20+
public boolean execute(PreparedStatement stmt) throws SQLException
21+
{
22+
return stmt.execute();
23+
}
24+
25+
public int[] executeBatch(Statement stmt) throws SQLException
26+
{
27+
return stmt.executeBatch();
28+
}
29+
1830
public void setDatabaseName(String dbName)
1931
{
2032
}

java/src/main/java/com/genexus/db/driver/GXDBMSas400.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ public ResultSet executeQuery(PreparedStatement stmt, boolean hold) throws SQLEx
4040
return stmt.executeQuery();
4141
}
4242

43+
public int executeUpdate(PreparedStatement stmt) throws SQLException
44+
{
45+
return stmt.executeUpdate();
46+
}
47+
48+
public boolean execute(PreparedStatement stmt) throws SQLException
49+
{
50+
return stmt.execute();
51+
}
52+
53+
public int[] executeBatch(Statement stmt) throws SQLException
54+
{
55+
return stmt.executeBatch();
56+
}
57+
4358
public boolean DataTruncation(SQLException e)
4459
{
4560
return (e.getErrorCode() == 01004 );

java/src/main/java/com/genexus/db/driver/GXDBMScloudscape.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ public ResultSet executeQuery(PreparedStatement stmt, boolean hold) throws SQLEx
2929
return stmt.executeQuery();
3030
}
3131

32+
public int executeUpdate(PreparedStatement stmt) throws SQLException
33+
{
34+
return stmt.executeUpdate();
35+
}
36+
37+
public boolean execute(PreparedStatement stmt) throws SQLException
38+
{
39+
return stmt.execute();
40+
}
41+
42+
public int[] executeBatch(Statement stmt) throws SQLException
43+
{
44+
return stmt.executeBatch();
45+
}
46+
3247
public boolean isAlive(GXConnection con)
3348
{
3449

0 commit comments

Comments
 (0)