<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.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

import org.junit.Assert;
import org.junit.Test;

import com.seanox.test.utils.ResourceUtils;
import com.seanox.test.utils.Timing;

/**
 * Test cases for {@link com.seanox.devwex.Generator}.<br>
 * <br>
 * GeneratorTest 5.1.1 20200608<br>
 * Copyright (C) 2020 Seanox Software Solutions<br>
 * All rights reserved.
 *
 * @author  Seanox Software Solutions
 * @version 5.1.1 20200608
 */
public class GeneratorTest extends AbstractTest {
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_1() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent().getBytes());
        Assert.assertEquals(ResourceUtils.getContent("testAcceptance_1_1"), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_2() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent().getBytes());
        Assert.assertEquals(ResourceUtils.getContent("testAcceptance_2_1"), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_3() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_0").getBytes());
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_4() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_0").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("/1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** 
     * Test case for acceptance. 
     * @throws Exception
     */
    @Test
    public void testAcceptance_5() throws Exception {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_0").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        for (int loop = 1; loop < 7; loop++) {
            String charX = Character.toString((char)('A' -1 + loop));
            values.put("case", charX + "1");
            values.put("name", charX + "2");
            values.put("date", charX + "3");
            values.put("size", charX + "4");
            values.put("type", charX + "5");
            values.put("mime", charX + "6");
            buffer.write(generator.extract("file", values));
        }
        values.put("file", buffer.toByteArray());
        generator.set(values);
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** 
     * Test case for acceptance. 
     * @throws Exception
     */
    public void testAcceptance_6() throws Exception {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_1").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        values.put("name", "A");
        values.put("date", "B");
        values.put("size", "C");
        values.put("type", "D");
        values.put("mime", "E");
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        Timing timing = Timing.create(true);
        for (long loop = 1; loop < 50000; loop++) {
            values.put("case", "X" + loop);
            buffer.write(generator.extract("file", values));
        }
        values.put("file", buffer.toByteArray());
        generator.set("file", values);
        generator.extract();
        timing.assertTimeIn(1250);
    }    
    
    /** Test case for acceptance. */
    public void testAcceptance_7() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_1").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        values.put("name", "A");
        values.put("date", "B");
        values.put("size", "C");
        values.put("type", "D");
        values.put("mime", "E");
        Timing timing = Timing.create(true);
        for (long loop = 1; loop < 2500; loop++) {
            values.put("case", "X" + loop);
            generator.set("file", values);
        }
        generator.extract();
        timing.assertTimeIn(1250);
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_8() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_1").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("/1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_9() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_2").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("/1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }

    /** Test case for acceptance. */
    @Test
    public void testAcceptance_A() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_2").getBytes());
        System.out.println("[INF] " + new String(generator.extract()));
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_B() {<commit_msg>#0000 Test: Update of test cases<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) 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.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

import org.junit.Assert;
import org.junit.Test;

import com.seanox.test.utils.ResourceUtils;
import com.seanox.test.utils.Timing;

/**
 * Test cases for {@link com.seanox.devwex.Generator}.<br>
 * <br>
 * GeneratorTest 5.1.1 20200608<br>
 * Copyright (C) 2020 Seanox Software Solutions<br>
 * All rights reserved.
 *
 * @author  Seanox Software Solutions
 * @version 5.1.1 20200608
 */
public class GeneratorTest extends AbstractTest {
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_1() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent().getBytes());
        Assert.assertEquals(ResourceUtils.getContent("testAcceptance_1_1"), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_2() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent().getBytes());
        Assert.assertEquals(ResourceUtils.getContent("testAcceptance_2_1"), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_3() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_0").getBytes());
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_4() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_0").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("/1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** 
     * Test case for acceptance. 
     * @throws Exception
     */
    @Test
    public void testAcceptance_5() throws Exception {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_0").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        for (int loop = 1; loop < 7; loop++) {
            String charX = Character.toString((char)('A' -1 + loop));
            values.put("case", charX + "1");
            values.put("name", charX + "2");
            values.put("date", charX + "3");
            values.put("size", charX + "4");
            values.put("type", charX + "5");
            values.put("mime", charX + "6");
            buffer.write(generator.extract("file", values));
        }
        values.put("file", buffer.toByteArray());
        generator.set(values);
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** 
     * Test case for acceptance. 
     * @throws Exception
     */
    @Test
    public void testAcceptance_6() throws Exception {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_1").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        values.put("name", "A");
        values.put("date", "B");
        values.put("size", "C");
        values.put("type", "D");
        values.put("mime", "E");
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        Timing timing = Timing.create(true);
        for (long loop = 1; loop < 50000; loop++) {
            values.put("case", "X" + loop);
            buffer.write(generator.extract("file", values));
        }
        values.put("file", buffer.toByteArray());
        generator.set("file", values);
        generator.extract();
        timing.assertTimeIn(1250);
    }    
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_7() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_1").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        values.put("name", "A");
        values.put("date", "B");
        values.put("size", "C");
        values.put("type", "D");
        values.put("mime", "E");
        Timing timing = Timing.create(true);
        for (long loop = 1; loop < 2500; loop++) {
            values.put("case", "X" + loop);
            generator.set("file", values);
        }
        generator.extract();
        timing.assertTimeIn(1250);
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_8() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_1").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("/1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_9() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_2").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("/1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }

    /** Test case for acceptance. */
    @Test
    public void testAcceptance_A() {
        
        Generator generator = Generator.parse(ResourceUtils.getContent("testAcceptance_0_2").getBytes());
        Hashtable<String, Object> values = new Hashtable<>();
        String path = new String();
        for (String entry : ("1/22/333/4444/55555").split("/")) {
            path = path.concat(entry);
            values.put("base", path);
            values.put("name", entry);
            generator.set("path", values);
        }
        Assert.assertEquals(ResourceUtils.getContent(), new String(generator.extract()));
    }
    
    /** Test case for acceptance. */
    @Test
    public void testAcceptance_B() {
{'fraction_non_alphanumeric': 0.13570925842984197, 'fraction_numerical': 0.020730692942606693, 'mean_word_length': 2.6433566433566433, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 39, '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': '515338', 'n_tokens_mistral': 4461, 'n_tokens_neox': 4273, 'n_words': 1088}