144 lines
4.7 KiB
Markdown
144 lines
4.7 KiB
Markdown
# Lts/Tests Module - Qt6 Migration
|
|
|
|
This directory contains the migrated `Lts/Tests` module from the Qt5 legacy codebase.
|
|
|
|
## Overview
|
|
|
|
The `Lts/Tests` module provides:
|
|
- Database initialization scripts for PostgreSQL
|
|
- Test data generators for various projects (GUEZ, AHTC, Qatar, L400P2, Demo, ComMaster)
|
|
- Symbol definition files (XML) and SQL generators
|
|
- Test scenario definitions
|
|
|
|
**Important**: This module does NOT build any C++ binaries. It only installs files and provides manual targets for database initialization.
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
Lts/Tests/
|
|
├── CMakeLists.txt # Main CMake configuration
|
|
├── DatabaseInitialisation/
|
|
│ ├── CMakeLists.txt # DB init CMake configuration
|
|
│ ├── README # Legacy documentation
|
|
│ ├── README.python3.md # Python 3 migration notes
|
|
│ ├── create_excon_db.py # Main DB creation script (Python 3)
|
|
│ ├── *.py # Supporting Python scripts
|
|
│ ├── *.sql # SQL initialization files
|
|
│ ├── AhtcSymbols/ # AHTC symbol definitions
|
|
│ ├── ComMasterSymbols/ # ComMaster symbol definitions
|
|
│ └── GuezSymbols/ # GUEZ symbol definitions
|
|
├── Bt56Test/ # FAT test data
|
|
└── Schnoeggersburg/ # Additional test data
|
|
```
|
|
|
|
## Manual Database Initialization Targets
|
|
|
|
After building with CMake, the following targets are available:
|
|
|
|
```bash
|
|
# Production databases
|
|
make db # Create GUEZ production database
|
|
make ahtc-db # Create AHTC production database
|
|
make qatar-db # Create Qatar production database
|
|
make l400p2-db # Create L400P2 production database
|
|
make demo-db # Create Demo production database
|
|
make commaster-db # Create ComMaster production database
|
|
|
|
# Test databases (with exercise data)
|
|
make test-db # Create GUEZ test database
|
|
make ahtc-test-db # Create AHTC test database
|
|
make qatar-test-db # Create Qatar test database
|
|
make l400p2-test-db # Create L400P2 test database
|
|
make demo-test-db # Create Demo test database
|
|
make commaster-test-db # Create ComMaster test database
|
|
```
|
|
|
|
**Note**: These targets require:
|
|
1. A running PostgreSQL instance
|
|
2. A valid `lts-cc.conf` configuration file
|
|
|
|
## Using db-manage.sh
|
|
|
|
The recommended way to manage databases is via the `db-manage.sh` script:
|
|
|
|
```bash
|
|
# Container management
|
|
./db-manage.sh start # Start PostgreSQL container
|
|
./db-manage.sh stop # Stop PostgreSQL container
|
|
./db-manage.sh status # Show container status
|
|
|
|
# Database initialization
|
|
./db-manage.sh init-db guez # Initialize GUEZ database
|
|
./db-manage.sh init-db ahtc # Initialize AHTC database
|
|
./db-manage.sh init-db test-db # Initialize test database
|
|
|
|
# Database operations
|
|
./db-manage.sh list-dbs # List all databases
|
|
./db-manage.sh psql guez # Open psql shell
|
|
./db-manage.sh backup guez # Create backup
|
|
./db-manage.sh restore guez file # Restore from backup
|
|
./db-manage.sh drop-db guez # Drop database
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The `lts-cc.conf` file contains database connection settings:
|
|
|
|
```ini
|
|
[Global]
|
|
DatabaseName=lts_ets_pro
|
|
DatabaseHostName=legatus-postgresql
|
|
DatabasePort=5432
|
|
DatabaseUser=postgres
|
|
DatabasePassword=postgres
|
|
```
|
|
|
|
**Locations**:
|
|
- Build tree: `qt6-after/qt6-migrated-legatus/lts-cc.conf`
|
|
- Installed: `/etc/lts-cc.conf`
|
|
|
|
## Python 3 Migration
|
|
|
|
All Python scripts have been ported from Python 2 to Python 3. See `DatabaseInitialisation/README.python3.md` for details.
|
|
|
|
## SQL Generation from XML
|
|
|
|
Symbol definitions are stored as XML files and can be converted to SQL:
|
|
|
|
```bash
|
|
# Generate AHTC symbol SQL
|
|
make generate-ahtc-symbols
|
|
|
|
# Generate GUEZ symbol SQL
|
|
make guez-generate-symbols
|
|
```
|
|
|
|
## SQL Syntax Validation
|
|
|
|
Validate SQL files against PostgreSQL syntax:
|
|
|
|
```bash
|
|
make validate-guez-symbols
|
|
make validate-ahtc-symbols
|
|
make validate-qatar-symbols
|
|
```
|
|
|
|
**Note**: Requires running PostgreSQL container.
|
|
|
|
## Installation
|
|
|
|
The module installs files to:
|
|
- `share/Lts/tests/` - Test scripts and data
|
|
- `share/Lts/tests/DatabaseInitialisation/` - DB initialization files
|
|
- `share/Lts/tests/Bt56Test/` - FAT test data
|
|
- `share/Lts/tests/Schnoeggersburg/` - Additional test data
|
|
|
|
## DEB Packages
|
|
|
|
This module is part of the following DEB packages:
|
|
- `legatus-qt6-ltscc` - Contains `/etc/lts-cc.conf`
|
|
- `legatus-qt6-sv` - Server installation
|
|
- `legatus-qt6-ws` - Workstation installation
|
|
- `legatus-qt6-aar` - AAR application installation
|
|
|
|
See `../../../specs/` for package specifications. |