Search in sources :

Example 1 with ProcessSuccessTester

use of de.dagere.peass.execution.processutils.ProcessSuccessTester in project peass by DaGeRe.

the class GradleTestExecutor method isVersionRunning.

@Override
public boolean isVersionRunning(final String version) {
    boolean isRunning = false;
    if (doesBuildfileExist()) {
        boolean isAndroid = false;
        for (final File module : getModules().getModules()) {
            final File buildfile = GradleParseHelper.findGradleFile(module);
            final FindDependencyVisitor visitor = GradleParseUtil.setAndroidTools(buildfile);
            if (visitor.isAndroid()) {
                isAndroid = true;
                if (!visitor.hasVersion()) {
                    return false;
                }
            }
        }
        this.isAndroid = isAndroid;
        ProjectModules modules = getModules();
        replaceAllBuildfiles(modules);
        final String[] vars = new String[] { env.fetchGradleCall(), "--no-daemon", "assemble" };
        ProcessSuccessTester processSuccessTester = new ProcessSuccessTester(folders, testTransformer.getConfig(), env);
        isRunning = processSuccessTester.testRunningSuccess(version, vars);
    }
    return isRunning;
}
Also used : ProjectModules(de.dagere.peass.execution.utils.ProjectModules) ProcessSuccessTester(de.dagere.peass.execution.processutils.ProcessSuccessTester) File(java.io.File)

Example 2 with ProcessSuccessTester

use of de.dagere.peass.execution.processutils.ProcessSuccessTester in project peass by DaGeRe.

the class MavenRunningTester method isVersionRunning.

public boolean isVersionRunning(final String version) {
    File potentialPom = new File(folders.getProjectFolder(), "pom.xml");
    final File testFolder = new File(folders.getProjectFolder(), "src/test");
    boolean isRunning = false;
    if (potentialPom.exists()) {
        try {
            final boolean multimodule = MavenPomUtil.isMultiModuleProject(potentialPom);
            if (multimodule || testFolder.exists()) {
                new MavenUpdater(folders, modules, measurementConfig).updateJava();
                String goal = getGoal();
                MavenPomUtil.cleanType(potentialPom);
                String[] basicParameters = new String[] { env.fetchMavenCall(), "--batch-mode", "clean", goal, "-DskipTests", "-Dmaven.test.skip.exec" };
                String[] withMavendefaults = CommandConcatenator.concatenateCommandArrays(basicParameters, CommandConcatenator.mavenCheckDeactivation);
                if (measurementConfig.getExecutionConfig().getPl() != null) {
                    String[] projectListArray = new String[] { "-pl", measurementConfig.getExecutionConfig().getPl(), "-am" };
                    String[] withPl = CommandConcatenator.concatenateCommandArrays(withMavendefaults, projectListArray);
                    isRunning = new ProcessSuccessTester(folders, measurementConfig, env).testRunningSuccess(version, withPl);
                } else {
                    isRunning = new ProcessSuccessTester(folders, measurementConfig, env).testRunningSuccess(version, withMavendefaults);
                }
            } else {
                LOG.error("Expected src/test to exist");
                return false;
            }
        } catch (IOException | XmlPullParserException e) {
            e.printStackTrace();
        }
    } else {
        LOG.error("No pom.xml in {}", version);
    }
    return isRunning;
}
Also used : ProcessSuccessTester(de.dagere.peass.execution.processutils.ProcessSuccessTester) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) IOException(java.io.IOException) File(java.io.File)

Aggregations

ProcessSuccessTester (de.dagere.peass.execution.processutils.ProcessSuccessTester)2 File (java.io.File)2 ProjectModules (de.dagere.peass.execution.utils.ProjectModules)1 IOException (java.io.IOException)1 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)1