Search in sources :

Example 76 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project core-java by SpineEventEngine.

the class ModelVerifierPluginShould method halt_build_on_malformed_command_handling_methods.

// TODO:2017-08-25:dmytro.dashenkov: Re-enable when Model is capable of
@Ignore
// https://github.com/SpineEventEngine/base/issues/49
@Test
public void halt_build_on_malformed_command_handling_methods() {
    final BuildResult result = newProjectWithJava("io/spine/model/verify/MalformedAggregate.java").executeAndFail(VERIFY_MODEL);
    final BuildTask task = result.task(toPath(VERIFY_MODEL));
    assertNotNull(task);
    final TaskOutcome generationResult = task.getOutcome();
    assertEquals(FAILED, generationResult);
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) BuildTask(org.gradle.testkit.runner.BuildTask) TaskOutcome(org.gradle.testkit.runner.TaskOutcome) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 77 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project core-java by SpineEventEngine.

the class ModelVerifierPluginShould method halt_build_on_duplicate_command_handling_methods.

@Test
public void halt_build_on_duplicate_command_handling_methods() {
    final BuildResult result = newProjectWithJava("io/spine/model/verify/DuplicateAggregate.java", "io/spine/model/verify/DuplicateCommandHandler.java").executeAndFail(VERIFY_MODEL);
    final BuildTask task = result.task(toPath(VERIFY_MODEL));
    assertNotNull(task);
    final TaskOutcome generationResult = task.getOutcome();
    assertEquals(FAILED, generationResult);
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) BuildTask(org.gradle.testkit.runner.BuildTask) TaskOutcome(org.gradle.testkit.runner.TaskOutcome) Test(org.junit.Test)

Example 78 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project wildfly-gradle-tools by wildfly.

the class CombinedPluginsTest method testFeaturePackTask.

@Test
public void testFeaturePackTask() throws Exception {
    BuildResult result = testProject.runTask("provision");
    assertEquals(TaskOutcome.SUCCESS, result.task(":provision").getOutcome());
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) Test(org.junit.Test)

Example 79 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project wildfly-gradle-tools by wildfly.

the class FeaturePackFunctionalTest method testFeaturePackTask.

@Test
public void testFeaturePackTask() throws Exception {
    BuildResult result = testProject.runTask("featurepack");
    assertEquals(result.task(":featurepack").getOutcome(), TaskOutcome.SUCCESS);
    File expectedModuleFile = new File(testProject.getWorkDirectory() + File.separator + "featurepack" + File.separator + "modules" + File.separator + "system" + File.separator + "layers" + File.separator + "base" + File.separator + "org" + File.separator + "hibernate" + File.separator + "orm53" + File.separator + "module.xml");
    assertTrue("The module.xml has not been created " + expectedModuleFile.getPath(), expectedModuleFile.exists());
    ModuleParseResult parseResult = ModuleParser.parse(expectedModuleFile.toPath());
    assertThat(parseResult.getIdentifier().getSlot(), is("orm53"));
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) File(java.io.File) ModuleParseResult(org.wildfly.build.util.ModuleParseResult) Test(org.junit.Test)

Example 80 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project liferay-blade-samples by liferay.

the class GradleRunnerUtil method executeGradleRunner.

public static BuildTask executeGradleRunner(File projectDir, String... taskPath) {
    GradleRunner runner = GradleRunner.create().withProjectDir(projectDir);
    GradleRunner runnerWithArguments = runner.withArguments(taskPath);
    BuildResult buildResult = runnerWithArguments.build();
    BuildTask buildtask = null;
    for (BuildTask task : buildResult.getTasks()) {
        if (task.getPath().endsWith(taskPath[taskPath.length - 1])) {
            buildtask = task;
            break;
        }
    }
    return buildtask;
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) BuildTask(org.gradle.testkit.runner.BuildTask) GradleRunner(org.gradle.testkit.runner.GradleRunner)

Aggregations

BuildResult (org.gradle.testkit.runner.BuildResult)143 File (java.io.File)62 TestTemplate (org.junit.jupiter.api.TestTemplate)60 Test (org.junit.Test)47 Test (org.junit.jupiter.api.Test)20 StringWriter (java.io.StringWriter)19 GradleRunner (org.gradle.testkit.runner.GradleRunner)17 Test (org.testng.annotations.Test)10 ImageReference (org.springframework.boot.buildpack.platform.docker.type.ImageReference)8 JarFile (java.util.jar.JarFile)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 TestHelpers.findFile (me.tatarka.TestHelpers.findFile)6 TestHelpers.writeFile (me.tatarka.TestHelpers.writeFile)6 ContainerConfig (com.github.dockerjava.api.model.ContainerConfig)5 FileWriter (java.io.FileWriter)5 IOException (java.io.IOException)5 PrintWriter (java.io.PrintWriter)5 Path (java.nio.file.Path)5 BufferedReader (java.io.BufferedReader)4