Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# app env
#---------------------------------------------
VALIDATOR_PATH=%kernel.project_dir%/bin/validator-cli.jar
VALIDATOR_JAVA_OPTS='-Xms256m -Xmx2g'
DATA_DIR=%kernel.project_dir%/var/data

#---------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
$validationsDir: "%env(resolve:DATA_DIR)%/validations"
$projectDir: "%kernel.project_dir%"
$validatorPath: "%ignf_validator.path%"
$validatorJavaOpts: "%env(resolve:VALIDATOR_JAVA_OPTS)%"
$gmlasConfigPath: "%env(resolve:GMLAS_CONFIG)%"

# makes classes in src/ available to be used as services
Expand Down
1 change: 1 addition & 0 deletions config/services_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
$validationsDir: "%env(resolve:DATA_DIR)%/validations-test"
$projectDir: "%kernel.project_dir%"
$validatorPath: "%ignf_validator.path%"
$validatorJavaOpts: "%env(resolve:VALIDATOR_JAVA_OPTS)%"
$gmlasConfigPath: "%env(resolve:GMLAS_CONFIG)%"

App\:
Expand Down
18 changes: 16 additions & 2 deletions src/Validation/ValidatorCLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class ValidatorCLI
*/
private $validatorPath;

/**
* @var string
*/
private $validatorJavaOpts;

/**
* GMLAS_CONFIG environment variable for validator-cli.jar to avoid lower case renaming for GML validation.
*
Expand All @@ -39,6 +44,7 @@ class ValidatorCLI
public function __construct(
ValidationsStorage $storage,
$validatorPath,
$validatorJavaOpts,
$gmlasConfigPath,
LoggerInterface $logger
) {
Expand All @@ -47,6 +53,7 @@ public function __construct(
if ( ! file_exists($this->validatorPath) ){
throw new ValidatorNotFoundException($this->validatorPath);
}
$this->validatorJavaOpts = $validatorJavaOpts;
$this->gmlasConfigPath = $gmlasConfigPath;
$this->logger = $logger;
}
Expand All @@ -66,9 +73,16 @@ public function process(Validation $validation)
$env = $_ENV;
$env['GMLAS_CONFIG'] = $this->gmlasConfigPath;

$args = $this->reconstructArgs($validation);

$sourceDataDir = $validationDirectory.'/'.$validation->getDatasetName();
$cmd = ['java', '-jar', $this->validatorPath, 'document_validator', '--input', $sourceDataDir];
$cmd = ['java'];
$cmd = \array_merge($cmd, explode(' ',$this->validatorJavaOpts));
$cmd = \array_merge($cmd,[
'-jar', $this->validatorPath,
'document_validator',
'--input', $sourceDataDir
]);
$args = $this->reconstructArgs($validation);
$cmd = \array_merge($cmd, $args);

// executing validation program
Expand Down