Search in sources :

Example 11 with Manifest

use of org.ballerinalang.toml.model.Manifest in project ballerina by ballerina-lang.

the class ManifestProcessorTest method testMixtureOfDependencies.

@Test(description = "Dependencies added both ways i.e. individually and multiple dependencies together has" + "an effect")
public void testMixtureOfDependencies() throws IOException {
    Manifest manifest = ManifestProcessor.parseTomlContentFromString("[dependencies.string-utils] \n " + "version = \"1.5\" \n location = \"src/string-utils\" \n [dependencies] \n " + "jquery = {version = \"2.2.3\"} \n react = {version = \"1.6.6\", location = \"npm-modules/react\"} \n" + "[dependencies.toml] \n version = \"1.4.5\" \n ");
    Assert.assertEquals(manifest.getDependencies().size(), 4);
    Assert.assertEquals(manifest.getDependencies().get(0).getPackageName(), "string-utils");
    Assert.assertEquals(manifest.getDependencies().get(0).getVersion(), "1.5");
    Assert.assertEquals(manifest.getDependencies().get(0).getLocation(), "src/string-utils");
    Assert.assertEquals(manifest.getDependencies().get(1).getPackageName(), "jquery");
    Assert.assertEquals(manifest.getDependencies().get(1).getVersion(), "2.2.3");
    Assert.assertEquals(manifest.getDependencies().get(1).getLocation(), null);
    Assert.assertEquals(manifest.getDependencies().get(2).getPackageName(), "react");
    Assert.assertEquals(manifest.getDependencies().get(2).getVersion(), "1.6.6");
    Assert.assertEquals(manifest.getDependencies().get(2).getLocation(), "npm-modules/react");
    Assert.assertEquals(manifest.getDependencies().get(3).getPackageName(), "toml");
    Assert.assertEquals(manifest.getDependencies().get(3).getVersion(), "1.4.5");
}
Also used : Manifest(org.ballerinalang.toml.model.Manifest) Test(org.testng.annotations.Test)

Example 12 with Manifest

use of org.ballerinalang.toml.model.Manifest in project ballerina by ballerina-lang.

the class ManifestProcessorTest method testSingleEmptyDependancies.

@Test(description = "Empty dependency added to the dependencies section has no effect")
public void testSingleEmptyDependancies() throws IOException {
    Manifest manifest = ManifestProcessor.parseTomlContentFromString("[dependencies] \n " + "string-utils = {} \n");
    Assert.assertEquals(manifest.getDependencies().get(0).getPackageName(), "string-utils");
}
Also used : Manifest(org.ballerinalang.toml.model.Manifest) Test(org.testng.annotations.Test)

Example 13 with Manifest

use of org.ballerinalang.toml.model.Manifest in project ballerina by ballerina-lang.

the class ManifestProcessorTest method testMultipleDependanciesAddedIndividually.

@Test(description = "Multiple dependencies added to the dependencies section individually has an effect")
public void testMultipleDependanciesAddedIndividually() throws IOException {
    Manifest manifest = ManifestProcessor.parseTomlContentFromString("[dependencies.string-utils] \n " + "version = \"1.1.5\" \n location = \"src/string-utils\" \n [dependencies.jquery] \n " + "version = \"2.2.3\"");
    Assert.assertEquals(manifest.getDependencies().get(0).getPackageName(), "string-utils");
    Assert.assertEquals(manifest.getDependencies().get(0).getVersion(), "1.1.5");
    Assert.assertEquals(manifest.getDependencies().get(0).getLocation(), "src/string-utils");
    Assert.assertEquals(manifest.getDependencies().get(1).getPackageName(), "jquery");
    Assert.assertEquals(manifest.getDependencies().get(1).getVersion(), "2.2.3");
    Assert.assertEquals(manifest.getDependencies().get(1).getLocation(), null);
}
Also used : Manifest(org.ballerinalang.toml.model.Manifest) Test(org.testng.annotations.Test)

Example 14 with Manifest

use of org.ballerinalang.toml.model.Manifest in project ballerina by ballerina-lang.

the class ManifestProcessorTest method testDependenciesAndPatches.

@Test(description = "Dependencies and patches added together has an effect")
public void testDependenciesAndPatches() throws IOException {
    Manifest manifest = ManifestProcessor.parseTomlContentFromString("[dependencies.string-utils] \n " + "version = \"1.1.5\" \n location = \"src/string-utils\" \n [patches] \n jobapi = {version =" + "\"2.23\"} \n [dependencies] \n jquery = {version = \"2.2.3\"} \n react = {version = \"1.6.6\", " + "location = \"npm-modules/react\"} \n [patches.toml] \n version = \"0.4.5\" \n");
    Assert.assertEquals(manifest.getDependencies().size(), 3);
    Assert.assertEquals(manifest.getPatches().size(), 2);
    Assert.assertEquals(manifest.getDependencies().get(0).getPackageName(), "string-utils");
    Assert.assertEquals(manifest.getDependencies().get(0).getVersion(), "1.1.5");
    Assert.assertEquals(manifest.getDependencies().get(1).getPackageName(), "jquery");
    Assert.assertEquals(manifest.getDependencies().get(2).getVersion(), "1.6.6");
    Assert.assertEquals(manifest.getPatches().get(0).getPackageName(), "jobapi");
    Assert.assertEquals(manifest.getPatches().get(1).getPackageName(), "toml");
}
Also used : Manifest(org.ballerinalang.toml.model.Manifest) Test(org.testng.annotations.Test)

Example 15 with Manifest

use of org.ballerinalang.toml.model.Manifest in project ballerina by ballerina-lang.

the class ManifestProcessorTest method testDocumentationURL.

@Test(description = "Documentation url in package section has an effect")
public void testDocumentationURL() throws IOException {
    Manifest manifest = ManifestProcessor.parseTomlContentFromString("[project] \n " + "documentation = \"https://ballerinalang.org/docs/api/0.95.5/\"");
    Assert.assertEquals(manifest.getDocumentationURL(), "https://ballerinalang.org/docs/api/0.95.5/");
}
Also used : Manifest(org.ballerinalang.toml.model.Manifest) Test(org.testng.annotations.Test)

Aggregations

Manifest (org.ballerinalang.toml.model.Manifest)29 Test (org.testng.annotations.Test)25 Path (java.nio.file.Path)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)2 SrcFile (org.ballerinalang.packerina.init.models.SrcFile)2 PrintStream (java.io.PrintStream)1 URI (java.net.URI)1 Scanner (java.util.Scanner)1 ParseTreeWalker (org.antlr.v4.runtime.tree.ParseTreeWalker)1 BLangCompilerException (org.ballerinalang.compiler.BLangCompilerException)1 CompileResult (org.ballerinalang.launcher.util.CompileResult)1 PackageID (org.ballerinalang.model.elements.PackageID)1 Name (org.wso2.ballerinalang.compiler.util.Name)1