<commit_before>/**
 * LIZENZBEDINGUNGEN - Seanox Software Solutions ist ein Open-Source-Projekt,
 * im Folgenden Seanox Software Solutions oder kurz Seanox genannt.
 * Diese Software unterliegt der Version 2 der GNU General Public License.
 *
 * Devwex, Advanced Server Development
 * Copyright (C) 2020 Seanox Software Solutions
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of version 2 of the GNU General Public License as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package com.seanox.devwex;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Collections;
import java.util.List;

import com.seanox.test.utils.HttpUtils.Keystore;
import com.seanox.test.utils.OutputFacadeStream;

/**
 * Abstract class to implements and use test suites.<br>
 * <br>
 * AbstractSuite 5.2.0 20201004<br>
 * Copyright (C) 2020 Seanox Software Solutions<br>
 * All rights reserved.
 *
 * @author  Seanox Software Solutions
 * @version 5.2.0 20201004
 */
public class AbstractSuite extends com.seanox.test.AbstractSuite {
    
    /** path of {@code ./stage} */
    final static String PATH_STAGE = "./stage";

    /** path of {@code ./stage/libraries} */
    final static String PATH_STAGE_LIBRARIES = "./stage/libraries";

    /** path of {@code ./stage/certificates} */
    final static String PATH_STAGE_CERTIFICATES = "./stage/certificates";

    /** path of {@code ./stage/output.log} */
    final static String PATH_STAGE_OUTPUT_LOG = "./stage/output.log";

    /** path of {@code ./stage/error.log} */
    final static String PATH_STAGE_ERROR_LOG = "./stage/error.log";

    /** path of {@code ./stage/access.log} */
    final static String PATH_STAGE_ACCESS_LOG = "./stage/access.log";
    
    /** path of {@code ./resources} */
    final static String PATH_RESOURCES = "./resources";    
    
    /** path of {@code ./resources/program} */
    final static String PATH_RESOURCES_PROGRAM = "./resources/program";
    
    /** keystore for SSL connections */
    private static Keystore keystore;
    
    /** synchronization of access file and acesss stream */
    private static Thread accessSynchronize;
    
    /** continuation reader for the access log */
    final static OutputFacadeStream accessStream = new OutputFacadeStream();  
    
    @Initiate
    @SuppressWarnings("unchecked")
    private static void initiate()
            throws Exception {
        
        if (!Charset.defaultCharset().name().equals("ISO-8859-1"))
            throw new RuntimeException("Character encoding ISO-8859-1 required");
        
        final File root = new File(".").getCanonicalFile();
        final File rootStage = new File(root, AbstractSuite.PATH_STAGE).getCanonicalFile();

        if (Files.exists(rootStage.toPath()))
            Files.walkFileTree(rootStage.toPath(), new SimpleFileVisitor<Path>() {<commit_msg>#0000 Test: Added check of runtime versin (major)<commit_after>/**
 * LIZENZBEDINGUNGEN - Seanox Software Solutions ist ein Open-Source-Projekt,
 * im Folgenden Seanox Software Solutions oder kurz Seanox genannt.
 * Diese Software unterliegt der Version 2 der GNU General Public License.
 *
 * Devwex, Advanced Server Development
 * Copyright (C) 2021 Seanox Software Solutions
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of version 2 of the GNU General Public License as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
package com.seanox.devwex;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Collections;
import java.util.List;

import com.seanox.test.utils.HttpUtils.Keystore;
import com.seanox.test.utils.OutputFacadeStream;

/**
 * Abstract class to implements and use test suites.<br>
 * <br>
 * AbstractSuite 5.3.0 20210314<br>
 * Copyright (C) 2021 Seanox Software Solutions<br>
 * All rights reserved.
 *
 * @author  Seanox Software Solutions
 * @version 5.3.0 20210314
 */
public class AbstractSuite extends com.seanox.test.AbstractSuite {
    
    /** path of {@code ./stage} */
    final static String PATH_STAGE = "./stage";

    /** path of {@code ./stage/libraries} */
    final static String PATH_STAGE_LIBRARIES = "./stage/libraries";

    /** path of {@code ./stage/certificates} */
    final static String PATH_STAGE_CERTIFICATES = "./stage/certificates";

    /** path of {@code ./stage/output.log} */
    final static String PATH_STAGE_OUTPUT_LOG = "./stage/output.log";

    /** path of {@code ./stage/error.log} */
    final static String PATH_STAGE_ERROR_LOG = "./stage/error.log";

    /** path of {@code ./stage/access.log} */
    final static String PATH_STAGE_ACCESS_LOG = "./stage/access.log";
    
    /** path of {@code ./resources} */
    final static String PATH_RESOURCES = "./resources";    
    
    /** path of {@code ./resources/program} */
    final static String PATH_RESOURCES_PROGRAM = "./resources/program";
    
    /** keystore for SSL connections */
    private static Keystore keystore;
    
    /** synchronization of access file and acesss stream */
    private static Thread accessSynchronize;
    
    /** continuation reader for the access log */
    final static OutputFacadeStream accessStream = new OutputFacadeStream();  
    
    @Initiate
    @SuppressWarnings("unchecked")
    private static void initiate()
            throws Exception {
        
        if (!Charset.defaultCharset().name().equals("ISO-8859-1"))
            throw new RuntimeException("Character encoding ISO-8859-1 required");
        
        String version = System.getProperty("java.version");
        if (Integer.valueOf(version.split("\\.")[0]).intValue() < 11)
            throw new RuntimeException("Java 11 or higher required");
        
        final File root = new File(".").getCanonicalFile();
        final File rootStage = new File(root, AbstractSuite.PATH_STAGE).getCanonicalFile();

        if (Files.exists(rootStage.toPath()))
            Files.walkFileTree(rootStage.toPath(), new SimpleFileVisitor<Path>() {
{'fraction_non_alphanumeric': 0.1069281045751634, 'fraction_numerical': 0.015032679738562092, 'mean_word_length': 3.402186421173763, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7237422', 'n_tokens_mistral': 2246, 'n_tokens_neox': 2099, 'n_words': 706}