Search in sources :

Example 11 with PowerShellInfo

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

the class PowerShellInfoProviderTest method testSelect32OVer64_Version.

/**
 * Both 64 bit and 32 bit PowerShells have good enough versions.
 * Any bitness is required
 * 64bit should be used
 */
@Test(dataProvider = "editionProvider")
public void testSelect32OVer64_Version(@NotNull final PowerShellEdition edition) {
    final Map<String, String> params = new HashMap<String, String>();
    mock32Bit("5.0", edition);
    mock64bit("5.0", edition);
    m.checking(new Expectations() {

        {
            allowing(myConfig).getConfigurationParameters();
            will(returnValue(params));
        }
    });
    final PowerShellInfo info = myProvider.selectTool(null, "3.0", null);
    assertNotNull(info);
    assertEquals(PowerShellBitness.x64, info.getBitness());
}
Also used : Expectations(org.jmock.Expectations) HashMap(java.util.HashMap) PowerShellInfo(jetbrains.buildServer.powershell.agent.detect.PowerShellInfo) Test(org.testng.annotations.Test)

Example 12 with PowerShellInfo

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

the class PowerShellInfoProviderTest method testNull_BitnessNotSatisfied_32_64.

@Test(dataProvider = "editionProvider")
public void testNull_BitnessNotSatisfied_32_64(@NotNull final PowerShellEdition edition) throws Exception {
    myHolder.addShellInfo(new PowerShellInfo(PowerShellBitness.x86, createTempDir(), "1.0", edition, "powershell.exe"));
    assertNull(myProvider.selectTool(PowerShellBitness.x64, null, null));
}
Also used : PowerShellInfo(jetbrains.buildServer.powershell.agent.detect.PowerShellInfo) Test(org.testng.annotations.Test)

Example 13 with PowerShellInfo

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

the class PowerShellInfoProviderTest method testUseSemanticVersion.

@Test(dataProvider = "editionProvider")
public void testUseSemanticVersion(@NotNull final PowerShellEdition edition) {
    final Map<String, String> params = new HashMap<String, String>();
    mock32Bit("3.0-beta4", edition);
    mock64bit("6.0-alpha6", edition);
    m.checking(new Expectations() {

        {
            allowing(myConfig).getConfigurationParameters();
            will(returnValue(params));
        }
    });
    final PowerShellInfo info = myProvider.selectTool(null, "4.0", null);
    assertNotNull(info);
    assertEquals(PowerShellBitness.x64, info.getBitness());
    assertEquals("6.0-alpha6", info.getVersion());
}
Also used : Expectations(org.jmock.Expectations) HashMap(java.util.HashMap) PowerShellInfo(jetbrains.buildServer.powershell.agent.detect.PowerShellInfo) Test(org.testng.annotations.Test)

Aggregations

PowerShellInfo (jetbrains.buildServer.powershell.agent.detect.PowerShellInfo)13 Test (org.testng.annotations.Test)6 HashMap (java.util.HashMap)5 Expectations (org.jmock.Expectations)5 NotNull (org.jetbrains.annotations.NotNull)4 File (java.io.File)3 PowerShellBitness (jetbrains.buildServer.powershell.common.PowerShellBitness)3 PowerShellEdition (jetbrains.buildServer.powershell.common.PowerShellEdition)3 RunBuildException (jetbrains.buildServer.RunBuildException)2 BuildProgressLogger (jetbrains.buildServer.agent.BuildProgressLogger)2 Nullable (org.jetbrains.annotations.Nullable)2 ExecutionException (com.intellij.execution.ExecutionException)1 PowerShellDetector (jetbrains.buildServer.powershell.agent.detect.PowerShellDetector)1 PowerShellExecutionMode (jetbrains.buildServer.powershell.common.PowerShellExecutionMode)1 Filter (jetbrains.buildServer.util.filters.Filter)1