Search in sources :

Example 56 with Collection

use of org.wso2.carbon.registry.api.Collection in project ballerina by ballerina-lang.

the class BallerinaFunctionDocGenTest method testABalWithNativeFunction.

@Test(description = "Test a Bal file with a native function")
public void testABalWithNativeFunction() {
    try {
        Map<String, BLangPackage> docsMap = BallerinaDocGenerator.generatePackageDocsFromBallerina(sourceRoot, "natives.bal", "", true);
        Assert.assertNotNull(docsMap);
        Assert.assertEquals(docsMap.size(), 1);
        BallerinaDocGenTestUtils.printDocMap(docsMap);
        BLangPackage doc = docsMap.get(".");
        Collection<BLangFunction> functions = doc.getFunctions();
        Assert.assertEquals(functions.size(), 1);
        BLangFunction function = functions.iterator().next();
        Assert.assertEquals(function.getParameters().size(), 1);
        Assert.assertEquals(function.getReturnParameters().size(), 1);
        Assert.assertEquals(function.getAnnotationAttachments().size(), 2);
    } catch (IOException e) {
        Assert.fail();
    } finally {
        BallerinaDocGenTestUtils.cleanUp();
    }
}
Also used : BLangPackage(org.wso2.ballerinalang.compiler.tree.BLangPackage) BLangFunction(org.wso2.ballerinalang.compiler.tree.BLangFunction) IOException(java.io.IOException) Test(org.testng.annotations.Test)

Example 57 with Collection

use of org.wso2.carbon.registry.api.Collection in project ballerina by ballerina-lang.

the class BallerinaFunctionDocGenTest method testABalWithOneFunction.

@Test(description = "Test a Bal file with one Function")
public void testABalWithOneFunction() {
    try {
        Map<String, BLangPackage> docsMap = BallerinaDocGenerator.generatePackageDocsFromBallerina(sourceRoot, "helloWorld.bal");
        Assert.assertNotNull(docsMap);
        Assert.assertEquals(docsMap.size(), 1);
        BallerinaDocGenTestUtils.printDocMap(docsMap);
        BLangPackage doc = docsMap.get(".");
        Collection<BLangFunction> functions = doc.getFunctions();
        Assert.assertEquals(functions.size(), 1);
        BLangFunction function = functions.iterator().next();
        Assert.assertEquals(function.getParameters().size(), 1);
        Assert.assertEquals(function.getReturnParameters().size(), 1);
    } catch (IOException e) {
        Assert.fail();
    } finally {
        BallerinaDocGenTestUtils.cleanUp();
    }
}
Also used : BLangPackage(org.wso2.ballerinalang.compiler.tree.BLangPackage) BLangFunction(org.wso2.ballerinalang.compiler.tree.BLangFunction) IOException(java.io.IOException) Test(org.testng.annotations.Test)

Aggregations

StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)13 Collection (java.util.Collection)9 ArrayList (java.util.ArrayList)8 ComplexEventChunk (org.wso2.siddhi.core.event.ComplexEventChunk)8 IOException (java.io.IOException)7 Collection (org.wso2.carbon.registry.core.Collection)7 Map (java.util.Map)6 HashSet (java.util.HashSet)5 File (java.io.File)4 InstanceFilter (org.apache.ode.bpel.common.InstanceFilter)4 BpelDAOConnection (org.apache.ode.bpel.dao.BpelDAOConnection)4 ProcessInstanceDAO (org.apache.ode.bpel.dao.ProcessInstanceDAO)4 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)4 Test (org.testng.annotations.Test)4 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)4 InstanceManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 HashMap (java.util.HashMap)3 Response (javax.ws.rs.core.Response)3 JAXBContext (javax.xml.bind.JAXBContext)3