Search in sources :

Example 6 with DiscoveredObject

use of jetbrains.buildServer.serverSide.discovery.DiscoveredObject in project teamcity-powershell by JetBrains.

the class PowerShellRunnerDiscoverer method discoverRunnersInDirectory.

@NotNull
@Override
protected List<DiscoveredObject> discoverRunnersInDirectory(@NotNull final Element dir, @NotNull final List<Element> filesAndDirs) {
    final List<DiscoveredObject> runners = new ArrayList<>();
    for (Element e : filesAndDirs) {
        if (e.isLeaf() && PS_EXT.equals(FileUtil.getExtension(e.getName()))) {
            final Map<String, String> parameters = new HashMap<>();
            parameters.put(PowerShellConstants.RUNNER_SCRIPT_FILE, e.getFullName());
            parameters.put(PowerShellConstants.RUNNER_EXECUTION_MODE, PowerShellExecutionMode.PS1.getValue());
            parameters.put(PowerShellConstants.RUNNER_SCRIPT_MODE, PowerShellScriptMode.FILE.getValue());
            runners.add(new DiscoveredObject(PowerShellConstants.RUN_TYPE, parameters));
        }
    }
    return runners;
}
Also used : Element(jetbrains.buildServer.util.browser.Element) DiscoveredObject(jetbrains.buildServer.serverSide.discovery.DiscoveredObject) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DiscoveredObject (jetbrains.buildServer.serverSide.discovery.DiscoveredObject)6 Element (jetbrains.buildServer.util.browser.Element)6 Expectations (org.jmock.Expectations)5 Test (org.testng.annotations.Test)5 SBuildRunnerDescriptor (jetbrains.buildServer.serverSide.SBuildRunnerDescriptor)1 NotNull (org.jetbrains.annotations.NotNull)1