<commit_before>package org.togglz.servlet.test.repository.cache;

import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.net.URL;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.descriptor.api.Descriptors;
import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.togglz.core.manager.TogglzConfig;
import org.togglz.test.Deployments;

import com.gargoylesoftware.htmlunit.TextPage;
import com.gargoylesoftware.htmlunit.WebClient;

@RunWith(Arquillian.class)
public class CacheRepositoryTest {

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        return Deployments.getBasicWebArchive()
                .addClass(CacheRepositoryConfiguration.class)
                .addClass(SlowStateRepository.class)
                .addClass(CacheFeatures.class)
                .setWebXML(new StringAsset(
                        Descriptors.create(WebAppDescriptor.class)
                                .contextParam(TogglzConfig.class.getName(), CacheRepositoryConfiguration.class.getName())
                                .exportAsString()));
    }

    @ArquillianResource
    private URL url;

    @Test
    public void testCachingOfFeatureState() throws IOException {

        WebClient client = new WebClient();

        long start = System.currentTimeMillis();
        for (int i = 0; i < 10; i++) {
            TextPage page = client.getPage(url + "features?user=ck");
            assertTrue(page.getContent().contains("F1 = false"));
        }
        long duration = System.currentTimeMillis() - start;

        assertTrue(duration < 2000); // without cache: 500ms * 10 = 5000ms

    }
}<commit_msg>Increase threshold for caching test success<commit_after>package org.togglz.servlet.test.repository.cache;

import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.net.URL;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.descriptor.api.Descriptors;
import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.togglz.core.manager.TogglzConfig;
import org.togglz.test.Deployments;

import com.gargoylesoftware.htmlunit.TextPage;
import com.gargoylesoftware.htmlunit.WebClient;

@RunWith(Arquillian.class)
public class CacheRepositoryTest {

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        return Deployments.getBasicWebArchive()
                .addClass(CacheRepositoryConfiguration.class)
                .addClass(SlowStateRepository.class)
                .addClass(CacheFeatures.class)
                .setWebXML(new StringAsset(
                        Descriptors.create(WebAppDescriptor.class)
                                .contextParam(TogglzConfig.class.getName(), CacheRepositoryConfiguration.class.getName())
                                .exportAsString()));
    }

    @ArquillianResource
    private URL url;

    @Test
    public void testCachingOfFeatureState() throws IOException {

        WebClient client = new WebClient();

        long start = System.currentTimeMillis();
        for (int i = 0; i < 10; i++) {
            TextPage page = client.getPage(url + "features?user=ck");
            assertTrue(page.getContent().contains("F1 = false"));
        }
        long duration = System.currentTimeMillis() - start;

        assertTrue(duration < 4000); // without cache: 500ms * 10 = 5000ms

    }
}
{'fraction_non_alphanumeric': 0.10188866799204771, 'fraction_numerical': 0.008449304174950299, 'mean_word_length': 3.107142857142857, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6004176', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1155, 'n_words': 199}