<commit_before>/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel.component.file;

import java.io.File;

import org.apache.camel.CamelContext;
import org.apache.camel.CamelTemplate;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.TestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

/**
 * @author <NAME>
 * @version $Revision$
 */
public class DirectoryCreateIssueTest extends TestSupport {
    private static final Logger LOG = Logger.getLogger(DirectoryCreateIssueTest.class);
    private CamelContext context;
    private CamelTemplate template;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        // The following code is removed
        // if you want to enable debugging, add the src/test/ide-resources directory to your IDE classpath
/*
        BasicConfigurator.configure();
        Logger.getRootLogger().setLevel(Level.DEBUG);
*/
        context = new DefaultCamelContext();
        context.start();
        template = new CamelTemplate(context);
    }

    @Override
    protected void tearDown() throws Exception {
        context.stop();
        super.tearDown();
    }

    public void testFileCreatedAsDir() throws Exception {
        log.debug("testFileCreatedAsDir");
        final String path = "target/a/b/c/d/e/f/g/h";
        final int numFiles = 10;

        context.addRoutes(
                new RouteBuilder() {
                    @Override
                    public void configure() {
                        String[] destinations = new String[numFiles];
                        for (int i = 0; i < numFiles; i++) {
                            destinations[i] = "seda:file" + i;

                            from("seda:file" + i)
                                    .setHeader(FileComponent.HEADER_FILE_NAME,
                                            constant("file" + i + ".txt"))
                                    .to("file://" + path + "/?append=false&noop=true");
                        }

                        from("seda:testFileCreatedAsDir")
                                .to(destinations);
                    }
                }
        );

        deleteDirectory(new File("a"));

        template.send("seda:testFileCreatedAsDir", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setBody("Contents of test file");
            }
        });

        Thread.sleep(2 * 1000);
        for (int i = 0; i < numFiles; i++) {
            assertTrue((new File(path + "/file" + i + ".txt")).isFile());
        }
    }
}

<commit_msg>Increased wait time to let the test go green on my system<commit_after>/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel.component.file;

import java.io.File;

import org.apache.camel.CamelContext;
import org.apache.camel.CamelTemplate;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.TestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

/**
 * @author <NAME>
 * @version $Revision$
 */
public class DirectoryCreateIssueTest extends TestSupport {
    private static final Logger LOG = Logger.getLogger(DirectoryCreateIssueTest.class);
    private CamelContext context;
    private CamelTemplate template;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        // The following code is removed
        // if you want to enable debugging, add the src/test/ide-resources directory to your IDE classpath
/*
        BasicConfigurator.configure();
        Logger.getRootLogger().setLevel(Level.DEBUG);
*/
        context = new DefaultCamelContext();
        context.start();
        template = new CamelTemplate(context);
    }

    @Override
    protected void tearDown() throws Exception {
        context.stop();
        super.tearDown();
    }

    public void testFileCreatedAsDir() throws Exception {
        log.debug("testFileCreatedAsDir");
        final String path = "target/a/b/c/d/e/f/g/h";
        final int numFiles = 10;

        context.addRoutes(
                new RouteBuilder() {
                    @Override
                    public void configure() {
                        String[] destinations = new String[numFiles];
                        for (int i = 0; i < numFiles; i++) {
                            destinations[i] = "seda:file" + i;

                            from("seda:file" + i)
                                    .setHeader(FileComponent.HEADER_FILE_NAME,
                                            constant("file" + i + ".txt"))
                                    .to("file://" + path + "/?append=false&noop=true");
                        }

                        from("seda:testFileCreatedAsDir")
                                .to(destinations);
                    }
                }
        );

        deleteDirectory(new File("a"));

        template.send("seda:testFileCreatedAsDir", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setBody("Contents of test file");
            }
        });

        Thread.sleep(8 * 1000);
        for (int i = 0; i < numFiles; i++) {
            assertTrue((new File(path + "/file" + i + ".txt")).isFile());
        }
    }
}


{'fraction_non_alphanumeric': 0.0990941531704639, 'fraction_numerical': 0.0043919846280538015, 'mean_word_length': 2.127467811158798, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6350160', 'n_tokens_mistral': 1930, 'n_tokens_neox': 1843, 'n_words': 569}