<commit_before>package com.tguzik.cwierkacz.application.configuration.reader;

import static com.google.common.collect.ImmutableList.of;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import com.google.common.collect.ImmutableMap;
import com.tguzik.cwierkacz.application.configuration.CacheConfiguration;
import com.tguzik.cwierkacz.application.configuration.CacheRegionConfiguration;
import com.tguzik.cwierkacz.application.configuration.CwierkaczConfiguration;
import com.tguzik.cwierkacz.application.configuration.DatabaseConfiguration;
import com.tguzik.cwierkacz.application.configuration.InterfaceConfiguration;
import com.tguzik.cwierkacz.application.configuration.JobsConfiguration;
import com.tguzik.cwierkacz.application.configuration.ProcessorsConfiguration;
import com.tguzik.cwierkacz.application.configuration.SingleInterfaceConfiguration;
import com.tguzik.cwierkacz.application.configuration.SingleJobConfiguration;
import com.tguzik.cwierkacz.application.configuration.SingleProcessorConfiguration;
import com.tguzik.cwierkacz.application.configuration.ThreadPoolConfiguration;
import com.tguzik.cwierkacz.cache.loader.NoOperationDataObjectLoader;
import com.tguzik.cwierkacz.processing.postprocessor.artifacts.ArtifactsProcessor;
import com.tguzik.cwierkacz.processing.postprocessor.email.EmailNotificationProcessor;
import com.tguzik.cwierkacz.processing.postprocessor.history.HistoryProcessor;
import com.tguzik.cwierkacz.processing.preprocessor.credentials.CredentialsValidationProcessor;
import com.tguzik.cwierkacz.processing.processor.account.AccountCreatorProcessor;
import com.tguzik.cwierkacz.processing.processor.account.AccountDeletionProcessor;
import com.tguzik.cwierkacz.processing.processor.account.AccountModificationProcessor;
import com.tguzik.cwierkacz.processing.processor.twitter.FetcherProcessor;
import com.tguzik.cwierkacz.processing.processor.twitter.PosterProcessor;

public class ApplicationDevConfigurationReaderTest
{
    private static final String PATH = "conf/dev/";

    @Test
    public void testReading( ) {
        CwierkaczConfiguration configuration = new ConfigurationReader(PATH).read();
        assertNotNull(configuration);
    }

    @Test
    public void testCacheConfiguration( ) {
        CacheConfiguration conf = read("cwierkacz.xml").getCache();
        assertNotNull(conf);

        assertEquals(2, conf.getRegionConfigs().size());
        verifyCacheConfiguration(conf.getRegionConfigs().get(0), "DEFAULT", 5000, true, true, false);
        verifyCacheConfiguration(conf.getRegionConfigs().get(1), "TWEETS", 20000, null, null, null);
    }

    private void verifyCacheConfiguration( CacheRegionConfiguration conf, String name, Integer maxObjects,
                                           Boolean cacheable, Boolean preloadable, Boolean disabled ) {
        assertNotNull(conf);
        assertEquals(name, conf.getName());
        assertEquals(maxObjects, conf.getMaxObjects());
        assertEquals(cacheable, conf.isCacheable());
        assertEquals(preloadable, conf.isPreloadable());
        assertEquals(disabled, conf.isDisabled());
    }

    @Test
    public void testDatabaseConfiguration( ) {
        DatabaseConfiguration conf = read("database.xml").getDatabase();
        assertNotNull(conf);

        assertEquals("localhost", conf.getUrl());
        assertEquals("db", conf.getUsername());
        assertEquals("password", String.valueOf(conf.getPassword()));
        assertEquals("CWIERKACZ", conf.getServiceName());
        assertEquals(NoOperationDataObjectLoader.class, conf.getDefaultDataLoader());
    }

    @Test
    public void testJobsConfiguration( ) {

        JobsConfiguration conf = read("jobs.xml").getJobs();
        assertNotNull(conf);

        assertEquals(5, conf.getJobs().size());
        verifySingleJob(conf.getJobs().get(0), "CREATE-SYSTEM-ACCOUNT", of(AC, SOH, SA, EN), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(1), "MODIFY-SYSTEM-ACCOUNT", of(CV, AM, SOH, SA), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(2), "DELETE-SYSTEM-ACCOUNT", of(CV, AD, SOH, SA), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(3), "POST-TWEET", of(CV, TP, SOH, SA), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(4), "FETCH-TWEETS", of(CV, TF, SOH, SA), EMPTYMAP);
    }

    private void verifySingleJob( SingleJobConfiguration job, String name, List<String> lifecycle,
                                  Map<String, String> properties ) {
        assertEquals(name, job.getName());
        assertEquals(lifecycle, job.getLifecycleStageNames());
        assertEquals(properties, job.getProperties());
    }
<commit_msg>Test commit - this is only empty test commit<commit_after>package com.tguzik.cwierkacz.application.configuration.reader;

import static com.google.common.collect.ImmutableList.of;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import com.google.common.collect.ImmutableMap;
import com.tguzik.cwierkacz.application.configuration.CacheConfiguration;
import com.tguzik.cwierkacz.application.configuration.CacheRegionConfiguration;
import com.tguzik.cwierkacz.application.configuration.CwierkaczConfiguration;
import com.tguzik.cwierkacz.application.configuration.DatabaseConfiguration;
import com.tguzik.cwierkacz.application.configuration.InterfaceConfiguration;
import com.tguzik.cwierkacz.application.configuration.JobsConfiguration;
import com.tguzik.cwierkacz.application.configuration.ProcessorsConfiguration;
import com.tguzik.cwierkacz.application.configuration.SingleInterfaceConfiguration;
import com.tguzik.cwierkacz.application.configuration.SingleJobConfiguration;
import com.tguzik.cwierkacz.application.configuration.SingleProcessorConfiguration;
import com.tguzik.cwierkacz.application.configuration.ThreadPoolConfiguration;
import com.tguzik.cwierkacz.cache.loader.NoOperationDataObjectLoader;
import com.tguzik.cwierkacz.processing.postprocessor.artifacts.ArtifactsProcessor;
import com.tguzik.cwierkacz.processing.postprocessor.email.EmailNotificationProcessor;
import com.tguzik.cwierkacz.processing.postprocessor.history.HistoryProcessor;
import com.tguzik.cwierkacz.processing.preprocessor.credentials.CredentialsValidationProcessor;
import com.tguzik.cwierkacz.processing.processor.account.AccountCreatorProcessor;
import com.tguzik.cwierkacz.processing.processor.account.AccountDeletionProcessor;
import com.tguzik.cwierkacz.processing.processor.account.AccountModificationProcessor;
import com.tguzik.cwierkacz.processing.processor.twitter.FetcherProcessor;
import com.tguzik.cwierkacz.processing.processor.twitter.PosterProcessor;

public class ApplicationDevConfigurationReaderTest
{
    private static final String PATH = "conf/dev/";

    @Test
    public void testReading( ) {
        CwierkaczConfiguration configuration = new ConfigurationReader(PATH).read();
        assertNotNull(configuration);
    }

    @Test
    public void testCacheConfiguration( ) {
        CacheConfiguration conf = read("cwierkacz.xml").getCache();
        assertNotNull(conf);

        assertEquals(2, conf.getRegionConfigs().size());
        verifyCacheConfiguration(conf.getRegionConfigs().get(0), "DEFAULT", 5000, true, true, false);
        verifyCacheConfiguration(conf.getRegionConfigs().get(1), "TWEETS", 20000, null, null, null);
    }

    private void verifyCacheConfiguration( CacheRegionConfiguration conf, String name, Integer maxObjects,
                                           Boolean cacheable, Boolean preloadable, Boolean disabled ) {
        assertNotNull(conf);
        assertEquals(name, conf.getName());
        assertEquals(maxObjects, conf.getMaxObjects());
        assertEquals(cacheable, conf.isCacheable());
        assertEquals(preloadable, conf.isPreloadable());
        assertEquals(disabled, conf.isDisabled());
    }

    @Test
    public void testDatabaseConfiguration( ) {
        DatabaseConfiguration conf = read("database.xml").getDatabase();

        assertNotNull(conf);

        assertEquals("localhost", conf.getUrl());
        assertEquals("db", conf.getUsername());
        assertEquals("password", String.valueOf(conf.getPassword()));
        assertEquals("CWIERKACZ", conf.getServiceName());
        assertEquals(NoOperationDataObjectLoader.class, conf.getDefaultDataLoader());
    }

    @Test
    public void testJobsConfiguration( ) {

        JobsConfiguration conf = read("jobs.xml").getJobs();
        assertNotNull(conf);

        assertEquals(5, conf.getJobs().size());
        verifySingleJob(conf.getJobs().get(0), "CREATE-SYSTEM-ACCOUNT", of(AC, SOH, SA, EN), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(1), "MODIFY-SYSTEM-ACCOUNT", of(CV, AM, SOH, SA), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(2), "DELETE-SYSTEM-ACCOUNT", of(CV, AD, SOH, SA), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(3), "POST-TWEET", of(CV, TP, SOH, SA), EMPTYMAP);
        verifySingleJob(conf.getJobs().get(4), "FETCH-TWEETS", of(CV, TF, SOH, SA), EMPTYMAP);
    }

    private void verifySingleJob( SingleJobConfiguration job, String name, List<String> lifecycle,
                                  Map<String, String> properties ) {
        assertEquals(name, job.getName());
        assertEquals(lifecycle, job.getLifecycleStageNames());
        assertEquals(properties, job.getProperties());
    }

{'fraction_non_alphanumeric': 0.11123853211009174, 'fraction_numerical': 0.0037531276063386154, 'mean_word_length': 4.713519952352591, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2775664', 'n_tokens_mistral': 2784, 'n_tokens_neox': 2782, 'n_words': 427}