Search in sources :

Example 21 with PackageID

use of org.ballerinalang.model.elements.PackageID in project ballerina by ballerina-lang.

the class RepoTest method testSystemOrgIsReserved.

@Test
public void testSystemOrgIsReserved() {
    PackageID pkg = newPackageID("ballerina", "any.pkg", "10.2.3");
    Repo subject = new NonSysRepo<String>(null) {

        @Override
        public Patten calculateNonSysPkg(PackageID pkg) {
            Assert.fail("Tried to calculate path for system packages");
            return null;
        }
    };
    Patten patten = subject.calculate(pkg);
    Assert.assertEquals(patten, Patten.NULL);
}
Also used : ObjRepo(org.wso2.ballerinalang.compiler.packaging.repo.ObjRepo) ProjectSourceRepo(org.wso2.ballerinalang.compiler.packaging.repo.ProjectSourceRepo) HomeRepo(org.wso2.ballerinalang.compiler.packaging.repo.HomeRepo) Repo(org.wso2.ballerinalang.compiler.packaging.repo.Repo) CacheRepo(org.wso2.ballerinalang.compiler.packaging.repo.CacheRepo) NonSysRepo(org.wso2.ballerinalang.compiler.packaging.repo.NonSysRepo) PackageID(org.ballerinalang.model.elements.PackageID) NonSysRepo(org.wso2.ballerinalang.compiler.packaging.repo.NonSysRepo) Patten(org.wso2.ballerinalang.compiler.packaging.Patten) Test(org.testng.annotations.Test)

Example 22 with PackageID

use of org.ballerinalang.model.elements.PackageID in project ballerina by ballerina-lang.

the class RepoTest method testHomeRepo.

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

Example 23 with PackageID

use of org.ballerinalang.model.elements.PackageID in project ballerina by ballerina-lang.

the class LSPackageCache method loadPackagesMap.

private void loadPackagesMap() {
    CompilerContext tempCompilerContext = CommonUtil.prepareTempCompilerContext();
    for (String staticPkgName : staticPkgNames) {
        PackageID packageID = new PackageID(new org.wso2.ballerinalang.compiler.util.Name("ballerina"), new org.wso2.ballerinalang.compiler.util.Name(staticPkgName), new org.wso2.ballerinalang.compiler.util.Name("0.0.0"));
        this.packageMap.put(getPackageName(packageID), LSPackageLoader.getPackageById(tempCompilerContext, packageID));
    }
}
Also used : CompilerContext(org.wso2.ballerinalang.compiler.util.CompilerContext) PackageID(org.ballerinalang.model.elements.PackageID)

Aggregations

PackageID (org.ballerinalang.model.elements.PackageID)23 Name (org.wso2.ballerinalang.compiler.util.Name)10 ArrayList (java.util.ArrayList)9 Test (org.testng.annotations.Test)8 Path (java.nio.file.Path)7 BLangPackage (org.wso2.ballerinalang.compiler.tree.BLangPackage)7 CompilerContext (org.wso2.ballerinalang.compiler.util.CompilerContext)7 List (java.util.List)6 Patten (org.wso2.ballerinalang.compiler.packaging.Patten)6 RepoHierarchy (org.wso2.ballerinalang.compiler.packaging.RepoHierarchy)6 IOException (java.io.IOException)5 URI (java.net.URI)5 Collectors (java.util.stream.Collectors)5 BLangCompilerException (org.ballerinalang.compiler.BLangCompilerException)5 Resolution (org.wso2.ballerinalang.compiler.packaging.Resolution)5 Names (org.wso2.ballerinalang.compiler.util.Names)5 Arrays (java.util.Arrays)4 Collections (java.util.Collections)4 Set (java.util.Set)4 CacheRepo (org.wso2.ballerinalang.compiler.packaging.repo.CacheRepo)4