Search in sources :

Example 1 with SRunningBuild

use of jetbrains.buildServer.serverSide.SRunningBuild in project teamcity-rest by JetBrains.

the class BuildArtifactsFinderTest method testOrderRecursive.

@Test
public void testOrderRecursive() throws Exception {
    final SRunningBuild runningBuild = myFixture.startBuild();
    final File artifactsDir = myFixture.finishBuild(runningBuild, false).getArtifactsDirectory();
    artifactsDir.mkdirs();
    createFileOfSize(artifactsDir, "file.txt", 5);
    createFileOfSize(artifactsDir, "a.txt", 5);
    // file with name like dir
    createFileOfSize(artifactsDir, "dir1", 0);
    File dir2 = new File(artifactsDir, "dir2");
    dir2.mkdir();
    createFileOfSize(dir2, "file.txt", 5);
    createFileOfSize(dir2, "filE1.txt", 0);
    File dir3 = new File(artifactsDir, "dir3");
    dir3.mkdir();
    File dir0 = new File(artifactsDir, "dir0");
    dir0.mkdir();
    createFileOfSize(dir0, "file13.txt", 5);
    createFileOfSize(dir0, "fil.txt", 5);
    createFileOfSize(dir0, "a", 5);
    createFileOfSize(dir0, "filf.txt", 5);
    createFileOfSize(dir0, "fild.txt", 5);
    createFileOfSize(dir0, "filE12.txt", 5);
    createFileOfSize(dir0, "filE14.txt", 5);
    createFileOfSize(dir0, "filE.txt", 5);
    File dir01 = new File(dir0, "dir01");
    dir01.mkdir();
    checkOrderedCollection(getNames(getArtifacts("", "recursive:true", null, runningBuild.getBuildPromotion())), "dir0", "dir0/dir01", "dir0/a", "dir0/fil.txt", "dir0/fild.txt", "dir0/filE.txt", "dir0/filE12.txt", "dir0/file13.txt", "dir0/filE14.txt", "dir0/filf.txt", "dir2", "dir2/file.txt", "dir2/filE1.txt", "dir3", "a.txt", "dir1", "file.txt");
}
Also used : SRunningBuild(jetbrains.buildServer.serverSide.SRunningBuild) File(java.io.File) Test(org.testng.annotations.Test)

Example 2 with SRunningBuild

use of jetbrains.buildServer.serverSide.SRunningBuild in project teamcity-rest by JetBrains.

the class BuildArtifactsFinderTest method testOrderSameLevel.

@Test
public void testOrderSameLevel() throws Exception {
    final SRunningBuild runningBuild = myFixture.startBuild();
    final File artifactsDir = myFixture.finishBuild(runningBuild, false).getArtifactsDirectory();
    artifactsDir.mkdirs();
    File dir = new File(artifactsDir, "orderTest");
    dir.mkdir();
    createFileOfSize(dir, "a1", 5);
    createFileOfSize(dir, "a4", 5);
    createFileOfSize(dir, "b1", 5);
    createFileOfSize(dir, "c1", 5);
    createFileOfSize(dir, "A21", 5);
    createFileOfSize(dir, "A2", 5);
    createFileOfSize(dir, "A3", 5);
    createFileOfSize(dir, "B2", 0);
    createFileOfSize(dir, "B4", 15);
    createFileOfSize(dir, "C2", 5);
    createFileOfSize(dir, "0", 5);
    createFileOfSize(dir, "1", 5);
    createFileOfSize(dir, "2", 5);
    createFileOfSize(dir, "10", 5);
    createFileOfSize(dir, "01", 5);
    createFileOfSize(dir, "_", 5);
    new File(dir, "B3").mkdir();
    File dir2 = new File(artifactsDir, "orderTesa");
    dir2.mkdir();
    createFileOfSize(dir2, "a2", 5);
    checkOrderedCollection(getNames(getArtifacts(dir.getName(), null, null, runningBuild.getBuildPromotion())), "orderTest/B3", "orderTest/0", "orderTest/01", "orderTest/1", "orderTest/2", "orderTest/10", "orderTest/_", "orderTest/a1", "orderTest/A2", "orderTest/A3", "orderTest/a4", "orderTest/A21", "orderTest/b1", "orderTest/B2", "orderTest/B4", "orderTest/c1", "orderTest/C2");
}
Also used : SRunningBuild(jetbrains.buildServer.serverSide.SRunningBuild) File(java.io.File) Test(org.testng.annotations.Test)

Example 3 with SRunningBuild

use of jetbrains.buildServer.serverSide.SRunningBuild in project teamcity-rest by JetBrains.

the class BuildArtifactsFinderTest method testOrderRecursiveCaseSensitiveFileSystem.

@Test
public void testOrderRecursiveCaseSensitiveFileSystem() throws Exception {
    if (!SystemInfo.isLinux) {
        throw new SkipException("Can only run on case-sensitive file system");
    }
    final SRunningBuild runningBuild = myFixture.startBuild();
    final File artifactsDir = myFixture.finishBuild(runningBuild, false).getArtifactsDirectory();
    artifactsDir.mkdirs();
    createFileOfSize(artifactsDir, "name_a", 5);
    createFileOfSize(artifactsDir, "nAme_A", 5);
    createFileOfSize(artifactsDir, "name_A", 5);
    createFileOfSize(artifactsDir, "name_B1", 0);
    createFileOfSize(artifactsDir, "name_b3", 5);
    File name_b2 = new File(artifactsDir, "name_b2");
    name_b2.mkdir();
    createFileOfSize(name_b2, "aa1", 0);
    createFileOfSize(name_b2, "aa3", 0);
    File name_B2 = new File(artifactsDir, "name_B2");
    name_B2.mkdir();
    createFileOfSize(name_B2, "aa2", 0);
    createFileOfSize(name_B2, "aa4", 0);
    createFileOfSize(artifactsDir, "name_C", 5);
    createFileOfSize(artifactsDir, "name_c", 5);
    checkOrderedCollection(getNames(getArtifacts("", "recursive:true", null, runningBuild.getBuildPromotion())), "name_b2", "name_b2/aa1", "name_b2/aa3", "name_B2", "name_B2/aa2", "name_B2/aa4", "name_a", "name_A", "nAme_A", "name_B1", "name_b3", "name_c", "name_C");
}
Also used : SRunningBuild(jetbrains.buildServer.serverSide.SRunningBuild) SkipException(org.testng.SkipException) File(java.io.File) Test(org.testng.annotations.Test)

Example 4 with SRunningBuild

use of jetbrains.buildServer.serverSide.SRunningBuild in project teamcity-rest by JetBrains.

the class BuildArtifactsFinderTest method suiteSetUp.

@BeforeClass
protected void suiteSetUp() throws IOException {
    TestDB.createSchemaIfNotCreated();
    myFixture = new BuildServerCreator(BuildArtifactsFinderTest.class, myTempFiles.createTempDir(), TestDB.getTestDBAccess());
    myFixture.createNewServer();
    myFixture.loadConfigurationFromDiskAndFireStartup();
    TimeCondition timeCondition = new TimeCondition(myFixture);
    myFixture.addService(timeCondition);
    final SRunningBuild runningBuild = myFixture.startBuild();
    myBuildWithArtifacts = myFixture.finishBuild(runningBuild, false);
    final File artifactsDir = myBuildWithArtifacts.getArtifactsDirectory();
    artifactsDir.mkdirs();
    createTestFiles(artifactsDir);
}
Also used : SRunningBuild(jetbrains.buildServer.serverSide.SRunningBuild) BuildServerCreator(jetbrains.BuildServerCreator) File(java.io.File) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

File (java.io.File)4 SRunningBuild (jetbrains.buildServer.serverSide.SRunningBuild)4 Test (org.testng.annotations.Test)3 BuildServerCreator (jetbrains.BuildServerCreator)1 SkipException (org.testng.SkipException)1 BeforeClass (org.testng.annotations.BeforeClass)1