use of org.ballerinalang.test.services.testutils.HTTPTestRequest in project ballerina by ballerina-lang.
the class GlobalVarServicePkgTest method testAssigningFuncInvFromDiffPkg.
@Test(description = "Test assigning function invocation from different package", enabled = false)
public void testAssigningFuncInvFromDiffPkg() {
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar-pkg/func-inv-from-diff-pkg", "GET");
HTTPCarbonMessage response = Services.invokeNew(result, cMsg);
Assert.assertNotNull(response);
// Expected Json message : {"glbVarPkgFunc":8876}
BJSON bJson = new BJSON(new HttpMessageDataStreamer(response).getInputStream());
Assert.assertEquals(bJson.value().get("glbVarPkgFunc").asText(), "8876");
}
use of org.ballerinalang.test.services.testutils.HTTPTestRequest in project ballerina by ballerina-lang.
the class GlobalVarServicePkgTest method testAssigningGlobalVarToServiceVarFromDiffPkg.
@Test(description = "Test assigning global variable to service variable from different package", enabled = false)
public void testAssigningGlobalVarToServiceVarFromDiffPkg() {
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar-pkg/assign-to-service-var-from-diff-pkg", "GET");
HTTPCarbonMessage response = Services.invokeNew(result, cMsg);
Assert.assertNotNull(response);
// Expected Json message : {"serviceVarString":"stringval"}
BJSON bJson = new BJSON(new HttpMessageDataStreamer(response).getInputStream());
Assert.assertEquals(bJson.value().get("serviceVarString").asText(), "stringval");
}
use of org.ballerinalang.test.services.testutils.HTTPTestRequest in project ballerina by ballerina-lang.
the class GlobalVarServicePkgTest method testAssigningFuncInvFromSamePkg.
@Test(description = "Test assigning function invocation from same package", enabled = false)
public void testAssigningFuncInvFromSamePkg() {
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar-pkg/func-inv-from-same-pkg", "GET");
HTTPCarbonMessage response = Services.invokeNew(result, cMsg);
Assert.assertNotNull(response);
// Expected Json message : {"glbVarFunc":423277.72343}
BJSON bJson = new BJSON(new HttpMessageDataStreamer(response).getInputStream());
Assert.assertEquals(bJson.value().get("glbVarFunc").asText(), "423277.72343");
}
use of org.ballerinalang.test.services.testutils.HTTPTestRequest in project ballerina by ballerina-lang.
the class GlobalVarServicePkgTest method testChangeAndAccessGlobalVarInDiffPkg.
@Test(description = "Test change global var in different package and access it", enabled = false)
public void testChangeAndAccessGlobalVarInDiffPkg() {
HTTPTestRequest cMsgChange = MessageUtils.generateHTTPMessage("/globalvar-pkg/change-global-var-diff-pkg", "GET");
Services.invokeNew(result, cMsgChange);
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar-second-pkg/get-changed-resource-level", "GET");
HTTPCarbonMessage response = Services.invokeNew(result, cMsg);
Assert.assertNotNull(response);
// Expected Json message : {"changeVarFloat":345432.454}
BJSON bJson = new BJSON(new HttpMessageDataStreamer(response).getInputStream());
Assert.assertEquals(bJson.value().get("changeVarFloat").asText(), "345432.454");
}
use of org.ballerinalang.test.services.testutils.HTTPTestRequest in project ballerina by ballerina-lang.
the class GlobalVarServiceTest method testAccessingChangedGlobalVarInAnotherResource.
@Test(description = "Test accessing changed global var in another resource in same service", enabled = false)
public void testAccessingChangedGlobalVarInAnotherResource() {
HTTPTestRequest cMsgChange = MessageUtils.generateHTTPMessage("/globalvar/change-resource-level", "GET");
Services.invokeNew(result, cMsgChange);
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar/get-changed-resource-level", "GET");
HTTPCarbonMessage response = Services.invokeNew(result, cMsg);
Assert.assertNotNull(response);
// Expected Json message : {"glbVarFloatChange":77.87}
BJSON bJson = new BJSON(new HttpMessageDataStreamer(response).getInputStream());
Assert.assertEquals(bJson.value().get("glbVarFloatChange").asText(), "77.87");
}
Aggregations