use of jetbrains.buildServer.util.TestFor in project teamcity-powershell by JetBrains.
the class RegistryPowerShellDetectorTest method testDetectPowerShell_5.
@Test
@TestFor(issues = "TW-41000")
public void testDetectPowerShell_5() {
m.checking(new Expectations() {
{
allowing(acc).readRegistryText(LOCAL_MACHINE, BIT32, "SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine", "PowerShellVersion");
will(returnValue("5.0"));
allowing(acc).readRegistryText(LOCAL_MACHINE, BIT32, "SOFTWARE\\Microsoft\\PowerShell\\1\\PowerShellEngine", "PowerShellVersion");
will(returnValue("2.0"));
}
});
final String ver = new PowerShellRegistry(BIT32, acc).getInstalledVersion();
assertEquals("5.0", ver);
}
use of jetbrains.buildServer.util.TestFor in project teamcity-powershell by JetBrains.
the class PowerShellInfoProviderTest method testSelectTool_MultipleShells.
@Test
@TestFor(issues = "TW-55922")
public void testSelectTool_MultipleShells() {
final Map<String, String> params = new HashMap<>();
mock64bit("6.1.0-preview.2", PowerShellEdition.CORE);
mock64bit("6.0", PowerShellEdition.CORE);
m.checking(new Expectations() {
{
allowing(myConfig).getConfigurationParameters();
will(returnValue(params));
}
});
final PowerShellInfo info = myProvider.selectTool(PowerShellBitness.x64, null, PowerShellEdition.CORE);
assertNotNull(info);
assertEquals("6.1.0-preview.2", info.getVersion());
}
use of jetbrains.buildServer.util.TestFor in project teamcity-powershell by JetBrains.
the class PowerShellRunTypeTest method shouldProviderSemanticVersionRestriction.
@Test(dataProvider = "bitnessAndVersionProvider")
@TestFor(issues = "TW-33570")
public void shouldProviderSemanticVersionRestriction(@NotNull final PowerShellBitness bitness, @Nullable final String version) {
final Map<String, String> parameters = createDummyParameters(bitness);
if (version != null) {
parameters.put(PowerShellConstants.RUNNER_MIN_VERSION, version);
}
final Collection<Requirement> requirements = runType.getRunnerSpecificRequirements(parameters);
assertEquals(1, requirements.size());
final Requirement req = requirements.iterator().next();
assertEquals("Exists=>(powershell_Core_" + bitness.getValue() + "|powershell_Desktop_" + bitness.getValue() + ")", req.getPropertyName());
if (version == null) {
assertEquals(RequirementType.EXISTS, req.getType());
} else {
assertEquals(RequirementType.VER_NO_LESS_THAN, req.getType());
assertEquals(version, req.getPropertyValue());
}
}
use of jetbrains.buildServer.util.TestFor in project teamcity-powershell by JetBrains.
the class RegistryPowerShellDetectorTest method testDetectPowerShell_ExtendedVersion.
@Test
@TestFor(issues = "TW-41000")
public void testDetectPowerShell_ExtendedVersion() {
m.checking(new Expectations() {
{
allowing(acc).readRegistryText(LOCAL_MACHINE, BIT32, "SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine", "PowerShellVersion");
will(returnValue("5.0.10105"));
allowing(acc).readRegistryText(LOCAL_MACHINE, BIT32, "SOFTWARE\\Microsoft\\PowerShell\\1\\PowerShellEngine", "PowerShellVersion");
will(returnValue("2.0"));
}
});
final String ver = new PowerShellRegistry(BIT32, acc).getInstalledVersion();
assertEquals("5.0.10105", ver);
}
use of jetbrains.buildServer.util.TestFor in project teamcity-rest by JetBrains.
the class ChangeFinderTest method testChangesByBuildTypeFromDependenciesHaveDescriptor.
@Test
@TestFor(issues = "TW-72448")
public void testChangesByBuildTypeFromDependenciesHaveDescriptor() {
final BuildTypeImpl buildConf1 = registerBuildType("buildConf1", "project");
final BuildTypeImpl buildConf2 = registerBuildType("buildConf2", "project");
createDependencyChain(buildConf2, buildConf1);
MockVcsSupport vcs = new MockVcsSupport("vcs");
vcs.setDAGBased(true);
myFixture.getVcsManager().registerVcsSupport(vcs);
SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf1);
SVcsRootEx parentRoot2 = myFixture.addVcsRoot(vcs.getName(), "", buildConf2);
VcsRootInstance root1 = buildConf1.getVcsRootInstanceForParent(parentRoot1);
VcsRootInstance root2 = buildConf2.getVcsRootInstanceForParent(parentRoot2);
assert root1 != null;
assert root2 != null;
setBranchSpec(root1, "+:*");
setBranchSpec(root2, "+:*");
final BuildFinderTestBase.MockCollectRepositoryChangesPolicy changesPolicy = new BuildFinderTestBase.MockCollectRepositoryChangesPolicy();
vcs.setCollectChangesPolicy(changesPolicy);
myFixture.addModification(modification().in(root1).version("1").parentVersions("0"));
myFixture.addModification(modification().in(root2).version("2").parentVersions("0"));
List<SVcsModificationOrChangeDescriptor> items = getFinder().getItems("buildType:buildConf2,changesFromDependencies:true,vcsRoot:(id:" + root1.getExternalId() + ")").myEntries;
assertEquals("There is exactly one pending change coming from dependency.", 1, items.size());
ChangeDescriptor descriptor = items.get(0).getChangeDescriptor();
assertNotNull("Depency change descriptor must be present when looking for changes using build type.", descriptor);
assertEquals(ChangeDescriptorConstants.SNAPSHOT_DEPENDENCY_VCS_CHANGE, descriptor.getType());
SVcsModification modification = items.get(0).getSVcsModification();
assertEquals("1", modification.getDisplayVersion());
}
Aggregations