<commit_before>package fi.jasoft.plugin.integration

import junit.framework.Assert
import org.apache.commons.io.FilenameUtils
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.junit.Assume
import org.junit.Before
import org.junit.Rule
import org.junit.rules.TemporaryFolder

import java.nio.file.Paths

/**
 * Created by john on 7/29/15.
 */
trait IntegrationTest {

    @Rule
    public final TemporaryFolder projectDir = new TemporaryFolder()

    File buildFile

    @Before
    void setup() {
        buildFile = projectDir.newFile("build.gradle")

        def libsDir = Paths.get('.', 'build', 'libs').toFile()
        Assume.assumeTrue("$libsDir does not exist", libsDir.exists())

        def escapedDir = libsDir.canonicalPath.replace("\\","\\\\")
        println "Repository for built dependencies $escapedDir"

        // Apply plugin to project
        buildFile << """
            buildscript {
                repositories {
                    mavenCentral()
                    flatDir dirs: file('$escapedDir')
                }

                dependencies {
                    classpath group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
                    classpath group: 'fi.jasoft.plugin', name: 'gradle-vaadin-plugin', version: 'SNAPSHOT-'+ new Date().format('yyyyMMdd')
                }
            }

            apply plugin: fi.jasoft.plugin.GradleVaadinPlugin
        """
    }

    String runWithArguments(String... args) {
        GradleRunner.create().withProjectDir(projectDir.root).withArguments(args).build().output
    }

    String runFailureExpected() {
        GradleRunner.create().withProjectDir(projectDir.root).buildAndFail().output
    }
}<commit_msg>Fixed integration test repository path to be Win compatible<commit_after>package fi.jasoft.plugin.integration

import junit.framework.Assert
import org.apache.commons.io.FilenameUtils
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.junit.Assume
import org.junit.Before
import org.junit.Rule
import org.junit.rules.TemporaryFolder

import java.nio.file.Paths

/**
 * Created by john on 7/29/15.
 */
trait IntegrationTest {

    @Rule
    public final TemporaryFolder projectDir = new TemporaryFolder()

    File buildFile

    @Before
    void setup() {
        buildFile = projectDir.newFile("build.gradle")


        def libsDir = Paths.get('.', 'build', 'libs').toFile()
        def escapedDir = libsDir.canonicalPath.replace("\\","\\\\")
        println "Repository for built dependencies $escapedDir"


        // Apply plugin to project
        buildFile << """
            buildscript {
                repositories {
                    mavenCentral()
                    flatDir dirs: file('$escapedDir')
                }

                dependencies {
                    classpath group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
                    classpath group: 'fi.jasoft.plugin', name: 'gradle-vaadin-plugin', version: 'SNAPSHOT-'+ new Date().format('yyyyMMdd')
                }
            }

            repositories {
                flatDir dirs: file('$escapedDir')
            }

            apply plugin: fi.jasoft.plugin.GradleVaadinPlugin
        """
    }

    String runWithArguments(String... args) {
        setupRunner().withArguments(args).build().output
    }

    String runFailureExpected() {
        setupRunner().buildAndFail().output
    }

    GradleRunner setupRunner() {
        GradleRunner.create().withProjectDir(projectDir.root)
    }
}
{'fraction_non_alphanumeric': 0.11477644492911669, 'fraction_numerical': 0.004362050163576881, 'mean_word_length': 2.3384895359417652, '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': '1373469', 'n_tokens_mistral': 1078, 'n_tokens_neox': 989, 'n_words': 206}