<commit_before>package com.adaptris.core.http.jetty.retry;

import static com.adaptris.core.http.jetty.retry.FilesystemRetryStoreTest.TEST_BASE_URL;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileFilter;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.junit.Before;
import org.junit.Test;
import com.adaptris.core.AdaptrisMessage;
import com.adaptris.core.DefaultMessageFactory;
import com.adaptris.core.ServiceException;
import com.adaptris.core.fs.FsHelper;
import com.adaptris.interlok.junit.scaffolding.BaseCase;
import com.adaptris.interlok.junit.scaffolding.services.ExampleServiceCase;

public class RetryStoreWriteTest extends ExampleServiceCase {

  private File retryStoreDir;

  @Before
  public void setUp() throws Exception {
    retryStoreDir = FsHelper.toFile(BaseCase.getConfiguration(TEST_BASE_URL));
  }

  @Test
  public void testService() throws Exception {
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
    RetryStoreWriteService service = new RetryStoreWriteService()
        .withRetryStore(new FilesystemRetryStore().withBaseUrl(getConfiguration(TEST_BASE_URL)));
    int base = retryStoreDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY).length;
    execute(service, msg);
    assertEquals(1,
        retryStoreDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY).length - base);
  }

  @Test(expected = ServiceException.class)
  public void testService_Exception() throws Exception {
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
    RetryStoreWriteService service = new RetryStoreWriteService()
        .withRetryStore(
            new FilesystemRetryStore().withBaseUrl(getConfiguration(TEST_BASE_URL) + "/ invalid"));
    execute(service, msg);
  }

  @Override
  protected RetryStoreWriteService retrieveObjectForSampleConfig() {
    return new RetryStoreWriteService().withRetryStore(new FilesystemRetryStore().withBaseUrl("file:///path/to/store"));

  }
}
<commit_msg>INTERLOK-3465 Bizare NPE on retryStoreDir in the test<commit_after>package com.adaptris.core.http.jetty.retry;

import static com.adaptris.core.http.jetty.retry.FilesystemRetryStoreTest.TEST_BASE_URL;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileFilter;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.junit.Test;
import com.adaptris.core.AdaptrisMessage;
import com.adaptris.core.DefaultMessageFactory;
import com.adaptris.core.ServiceException;
import com.adaptris.core.fs.FsHelper;
import com.adaptris.interlok.junit.scaffolding.BaseCase;
import com.adaptris.interlok.junit.scaffolding.services.ExampleServiceCase;

public class RetryStoreWriteTest extends ExampleServiceCase {

  @Test
  public void testService() throws Exception {
    File retryStoreDir = FsHelper.toFile(BaseCase.getConfiguration(TEST_BASE_URL));
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
    RetryStoreWriteService service = new RetryStoreWriteService()
        .withRetryStore(new FilesystemRetryStore().withBaseUrl(getConfiguration(TEST_BASE_URL)));
    int base = retryStoreDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY).length;
    execute(service, msg);
    assertEquals(1,
        retryStoreDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY).length - base);
  }

  @Test(expected = ServiceException.class)
  public void testService_Exception() throws Exception {
    File retryStoreDir = FsHelper.toFile(BaseCase.getConfiguration(TEST_BASE_URL));
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage("hello");
    RetryStoreWriteService service = new RetryStoreWriteService()
        .withRetryStore(
            new FilesystemRetryStore().withBaseUrl(getConfiguration(TEST_BASE_URL) + "/ invalid"));
    execute(service, msg);
  }

  @Override
  protected RetryStoreWriteService retrieveObjectForSampleConfig() {
    return new RetryStoreWriteService().withRetryStore(new FilesystemRetryStore().withBaseUrl("file:///path/to/store"));

  }
}

{'fraction_non_alphanumeric': 0.09894685280431055, 'fraction_numerical': 0.0014695077149155032, 'mean_word_length': 5.706075533661741, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6747979', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1174, 'n_words': 202}