@@ -0,0 +1,2843 @@
+package com.github.nodevops.confd.maven.plugin.processors.impl;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.junit.Assume.assumeTrue;%0A%0Aimport java.io.File;%0A%0Aimport org.codehaus.plexus.util.FileUtils;%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TemporaryFolder;%0A%0Aimport com.github.nodevops.confd.maven.plugin.AbstractTest;%0Aimport com.github.nodevops.confd.maven.plugin.TestUtils;%0Aimport com.github.nodevops.confd.maven.plugin.model.TemplateConfig;%0Aimport com.github.nodevops.confd.maven.plugin.processors.ProcessorContext;%0Aimport com.github.nodevops.confd.maven.plugin.utils.WorkingDirectoryUtil;%0A%0Apublic class LocalProcessorImplTest extends AbstractTest %7B%0A    private static final String ENCODING = %22UTF-8%22;%0A%0A    @Rule%0A    public TemporaryFolder temporaryFolder = new TemporaryFolder(new File(getBaseDir(), %22target%22));%0A%0A    private File resourcesDir;%0A    private File testDir;%0A    private File dictionaryFile;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        resourcesDir = new File(getBaseDir(), %22src/test/resources/unit/java-processor-test%22);%0A        testDir = temporaryFolder.newFolder();%0A        dictionaryFile = new File(testDir, %22dictionaries/env01.dict%22);%0A%0A        FileUtils.mkdir(new File(testDir, %22conf.d%22).getAbsolutePath());%0A        FileUtils.copyDirectoryStructure(resourcesDir, testDir);%0A%0A    %7D%0A%0A    @Test%0A    public void shouldSuccessWithTemplateAsPropertiesAndTargetInANonExistingDirectory() throws Exception %7B%0A        assumeTrue(!TestUtils.isRunningOnWindows());%0A        System.out.println(%22Running this test because I'm not running on Windows%22);%0A        String confdPath = System.getProperty(%22confd.local.path.for.tests%22);%0A        if (confdPath == null) %7B%0A            confdPath = %22/usr/local/bin/confd%22;%0A        %7D%0A%0A        File tomlFile = new File(testDir, %22conf.d/template01.toml%22);%0A        File destinationFile = new File(testDir, %22subDirectory/file01.properties%22);%0A        File expectedFile = new File(resourcesDir, %22expected01.properties%22);%0A%0A        TemplateConfig templateConfig = new TemplateConfig();%0A        templateConfig.setSrc(new File(%22template01.tmpl%22));%0A        templateConfig.setDest(destinationFile);%0A        templateConfig.setKeys(new String%5B%5D%7B%22/web%22%7D);%0A%0A        WorkingDirectoryUtil.writeToml(tomlFile, templateConfig);%0A%0A        ProcessorContext context = ProcessorContext.builder()%0A            .workingDirectory(testDir)%0A            .dictionaryPath(dictionaryFile)%0A            .encoding(ENCODING)%0A            .mkdirs(true)%0A            .build();%0A%0A        LocalConfdProcessorImpl localConfdProcessor = new LocalConfdProcessorImpl(confdPath);%0A        localConfdProcessor.process(context);%0A%0A        assertThat(destinationFile).exists();%0A        assertThat(destinationFile).hasSameContentAs(expectedFile);%0A    %7D%0A%0A%7D%0A

test the local processor when not running on Windows