use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class ConfigTest method testSetConfig.
@Test(description = "Test setting configs from Ballerina source code")
public void testSetConfig() throws IOException {
BString key = new BString("ballerina.http.host");
BString value = new BString("ballerinalang.org");
BValue[] inputArgs = { key, value };
registry.initRegistry(getRuntimeProperties(), customConfigFilePath, ballerinaConfPath);
BRunUtil.invoke(compileResult, "testSetConfig", inputArgs);
// The config we set in Ballerina code should overwrite the configs set from other sources
Assert.assertEquals(registry.getConfiguration(key.stringValue()), value.stringValue());
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class ConfigTest method testGetInstanceValuesWithAllProperties.
@Test(description = "test instance method with runtime, custom and default config file properties")
public void testGetInstanceValuesWithAllProperties() throws IOException {
BString key = new BString("http1.ballerina.http.port");
BValue[] inputArg = { key };
registry.initRegistry(getRuntimeProperties(), customConfigFilePath, ballerinaConfPath);
BValue[] returnVals = BRunUtil.invoke(compileResult, "testGetAsString", inputArg);
Assert.assertFalse(returnVals == null || returnVals.length == 0 || returnVals[0] == null, "Invalid Return Values.");
Assert.assertTrue(returnVals[0] instanceof BString);
Assert.assertEquals(returnVals[0].stringValue(), "8082");
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class ConfigTest method testGetAsStringWithRuntime.
@Test(description = "test global method with runtime and custom config file properties")
public void testGetAsStringWithRuntime() throws IOException {
BString key = new BString("ballerina.http.host");
BValue[] inputArg = { key };
registry.initRegistry(getRuntimeProperties(), customConfigFilePath, ballerinaConfPath);
BValue[] returnVals = BRunUtil.invoke(compileResult, "testGetAsString", inputArg);
Assert.assertFalse(returnVals == null || returnVals.length == 0 || returnVals[0] == null, "Invalid Return Values.");
Assert.assertTrue(returnVals[0] instanceof BString);
Assert.assertEquals(returnVals[0].stringValue(), "10.100.1.201");
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class SQLActionsTest method testGeneratedKeyOnInsert.
@Test(groups = "ConnectorTest")
public void testGeneratedKeyOnInsert() {
BValue[] returns = BRunUtil.invoke(result, "testGeneratedKeyOnInsert");
BString retValue = (BString) returns[0];
Assert.assertTrue(Integer.parseInt(retValue.stringValue()) > 0);
}
use of org.ballerinalang.model.values.BValue in project ballerina by ballerina-lang.
the class SQLActionsTest method testNullINParameters.
@Test(groups = "ConnectorTest", enabled = false)
public void testNullINParameters() {
BValue[] returns = BRunUtil.invoke(result, "testNullINParameters");
BInteger retValue = (BInteger) returns[0];
Assert.assertEquals(retValue.intValue(), 1);
}
Aggregations