Search in sources :

Example 1 with PowerShellDetector

use of jetbrains.buildServer.powershell.agent.detect.PowerShellDetector in project teamcity-powershell by JetBrains.

the class PowerShellInfoProvider method registerDetectedPowerShells.

private void registerDetectedPowerShells(@NotNull final List<PowerShellDetector> detectors, @NotNull final DetectionContext detectionContext) {
    Map<String, PowerShellInfo> shells = new HashMap<String, PowerShellInfo>();
    for (PowerShellDetector detector : detectors) {
        for (Map.Entry<String, PowerShellInfo> entry : detector.findShells(detectionContext).entrySet()) {
            if (!shells.containsKey(entry.getKey())) {
                shells.put(entry.getKey(), entry.getValue());
                entry.getValue().saveInfo(myConfig);
                myHolder.addShellInfo(entry.getValue());
            }
        }
    }
    // provide parameters for agent compatibility filters
    if (!myHolder.getShells().isEmpty()) {
        provideMaxVersions();
        provideCompatibilityParams();
    }
}
Also used : PowerShellDetector(jetbrains.buildServer.powershell.agent.detect.PowerShellDetector) PowerShellInfo(jetbrains.buildServer.powershell.agent.detect.PowerShellInfo)

Example 2 with PowerShellDetector

use of jetbrains.buildServer.powershell.agent.detect.PowerShellDetector in project teamcity-powershell by JetBrains.

the class PowerShellInfoProviderTest method setUp.

@Override
@BeforeMethod
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    super.setUp();
    m = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
        }
    };
    myEvents = m.mock(EventDispatcher.class);
    myConfig = m.mock(BuildAgentConfiguration.class);
    myHolder = new ShellInfoHolder();
    m.checking(new Expectations() {

        {
            allowing(myEvents);
        }
    });
    myTempHome = createTempDir();
    myProvider = new PowerShellInfoProvider(myConfig, myEvents, Collections.<PowerShellDetector>emptyList(), myHolder);
}
Also used : Expectations(org.jmock.Expectations) PowerShellDetector(jetbrains.buildServer.powershell.agent.detect.PowerShellDetector) EventDispatcher(jetbrains.buildServer.util.EventDispatcher) Mockery(org.jmock.Mockery) BuildAgentConfiguration(jetbrains.buildServer.agent.BuildAgentConfiguration) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

PowerShellDetector (jetbrains.buildServer.powershell.agent.detect.PowerShellDetector)2 BuildAgentConfiguration (jetbrains.buildServer.agent.BuildAgentConfiguration)1 PowerShellInfo (jetbrains.buildServer.powershell.agent.detect.PowerShellInfo)1 EventDispatcher (jetbrains.buildServer.util.EventDispatcher)1 Expectations (org.jmock.Expectations)1 Mockery (org.jmock.Mockery)1 BeforeMethod (org.testng.annotations.BeforeMethod)1