use of org.wso2.transport.http.netty.message.HTTPCarbonMessage 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.wso2.transport.http.netty.message.HTTPCarbonMessage 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");
}
use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class GlobalVarServiceTest method testAccessingChangedGlobalVarInAnotherResourceInAnotherService.
@Test(description = "Test accessing changed global var in another resource in different service", enabled = false)
public void testAccessingChangedGlobalVarInAnotherResourceInAnotherService() {
HTTPTestRequest cMsgChange = MessageUtils.generateHTTPMessage("/globalvar/change-resource-level", "GET");
Services.invokeNew(result, cMsgChange);
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar-second/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");
}
use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class GlobalVarServiceTest method testDefiningGlobalVarInService.
@Test(description = "Test defining global variables in services", enabled = false)
public void testDefiningGlobalVarInService() {
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar/defined", "GET");
HTTPCarbonMessage response = Services.invokeNew(result, cMsg);
Assert.assertNotNull(response);
// Expected Json message : {"glbVarInt":800, "glbVarString":"value", "glbVarFloat":99.34323}
BJSON bJson = new BJSON(new HttpMessageDataStreamer(response).getInputStream());
Assert.assertEquals(bJson.value().get("glbVarInt").asText(), "800");
Assert.assertEquals(bJson.value().get("glbVarString").asText(), "value");
Assert.assertEquals(bJson.value().get("glbVarFloat").asText(), "99.34323");
}
use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class GlobalVarServiceTest method testAccessingGlobalVarInServiceLevel.
@Test(description = "Test accessing global variables in service level", enabled = false)
public void testAccessingGlobalVarInServiceLevel() {
HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage("/globalvar/access-service-level", "GET");
HTTPCarbonMessage response = Services.invokeNew(result, cMsg);
Assert.assertNotNull(response);
// Expected Json message : {"serviceVarFloat":99.34323}
BJSON bJson = new BJSON(new HttpMessageDataStreamer(response).getInputStream());
Assert.assertEquals(bJson.value().get("serviceVarFloat").asText(), "99.34323");
}
Aggregations