Search in sources :

Example 1 with PathConverter

use of org.wso2.ballerinalang.compiler.packaging.converters.PathConverter in project ballerina by ballerina-lang.

the class PathConverterIntegrationTest method testWildcard.

@Test
public void testWildcard() {
    Patten patten = new Patten(WILDCARD_DIR, path("deep"), WILDCARD_DIR, path("dir.bal", "tempFile.bal"));
    PathConverter subject = new PathConverter(tempDirectory);
    Stream<Path> pathStream = patten.convert(subject);
    List<Path> paths = pathStream.collect(Collectors.toList());
    Assert.assertEquals(paths.size(), 1);
    Assert.assertEquals(paths.get(0).toString(), tempFile.toString());
}
Also used : Path(java.nio.file.Path) PathConverter(org.wso2.ballerinalang.compiler.packaging.converters.PathConverter) Patten(org.wso2.ballerinalang.compiler.packaging.Patten) Test(org.testng.annotations.Test)

Example 2 with PathConverter

use of org.wso2.ballerinalang.compiler.packaging.converters.PathConverter in project ballerina by ballerina-lang.

the class RepoTest method testProjectSourceRepo.

@Test
public void testProjectSourceRepo() {
    PackageID pkg = newPackageID("best_org", "this.pkg", "1.8.3");
    ProjectSourceRepo subject = new ProjectSourceRepo((PathConverter) null);
    Patten prospect = subject.calculate(pkg);
    Assert.assertEquals(prospect.toString(), "$/this.pkg/**~test~resources/*.bal");
}
Also used : PackageID(org.ballerinalang.model.elements.PackageID) Patten(org.wso2.ballerinalang.compiler.packaging.Patten) ProjectSourceRepo(org.wso2.ballerinalang.compiler.packaging.repo.ProjectSourceRepo) Test(org.testng.annotations.Test)

Example 3 with PathConverter

use of org.wso2.ballerinalang.compiler.packaging.converters.PathConverter in project ballerina by ballerina-lang.

the class RepoTest method testCacheRepo.

@Test
public void testCacheRepo() {
    PackageID pkg = newPackageID("nice_org", "any.pkg", "10.2.3");
    CacheRepo subject = new CacheRepo((PathConverter) null);
    Patten patten = subject.calculate(pkg);
    Assert.assertEquals(patten.toString(), "$/caches/*/nice_org/any.pkg/10.2.3/src/**~test~resources/*.bal");
}
Also used : CacheRepo(org.wso2.ballerinalang.compiler.packaging.repo.CacheRepo) PackageID(org.ballerinalang.model.elements.PackageID) Patten(org.wso2.ballerinalang.compiler.packaging.Patten) Test(org.testng.annotations.Test)

Example 4 with PathConverter

use of org.wso2.ballerinalang.compiler.packaging.converters.PathConverter in project ballerina by ballerina-lang.

the class PathConverterIntegrationTest method testBalSearch.

@Test
public void testBalSearch() {
    Patten patten = new Patten(path("very"), Patten.WILDCARD_SOURCE);
    PathConverter subject = new PathConverter(tempDirectory);
    Stream<Path> pathStream = patten.convert(subject);
    List<Path> paths = pathStream.collect(Collectors.toList());
    Assert.assertEquals(paths.size(), 1);
    Assert.assertEquals(paths.get(0).toString(), tempFile.toString());
}
Also used : Path(java.nio.file.Path) PathConverter(org.wso2.ballerinalang.compiler.packaging.converters.PathConverter) Patten(org.wso2.ballerinalang.compiler.packaging.Patten) Test(org.testng.annotations.Test)

Example 5 with PathConverter

use of org.wso2.ballerinalang.compiler.packaging.converters.PathConverter in project ballerina by ballerina-lang.

the class RepoTest method testProjectObjRepo.

@Test
public void testProjectObjRepo() {
    PackageID pkg = newPackageID("my_org", "my.pkg", "1.2.3");
    ObjRepo subject = new ObjRepo((PathConverter) null);
    Patten patten = subject.calculate(pkg);
    Assert.assertEquals(patten.toString(), "$/repo/my_org/my.pkg/1.2.3/obj/my.pkg.balo");
}
Also used : PackageID(org.ballerinalang.model.elements.PackageID) ObjRepo(org.wso2.ballerinalang.compiler.packaging.repo.ObjRepo) Patten(org.wso2.ballerinalang.compiler.packaging.Patten) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)6 Patten (org.wso2.ballerinalang.compiler.packaging.Patten)6 PackageID (org.ballerinalang.model.elements.PackageID)4 Path (java.nio.file.Path)2 PathConverter (org.wso2.ballerinalang.compiler.packaging.converters.PathConverter)2 CacheRepo (org.wso2.ballerinalang.compiler.packaging.repo.CacheRepo)1 HomeRepo (org.wso2.ballerinalang.compiler.packaging.repo.HomeRepo)1 ObjRepo (org.wso2.ballerinalang.compiler.packaging.repo.ObjRepo)1 ProjectSourceRepo (org.wso2.ballerinalang.compiler.packaging.repo.ProjectSourceRepo)1