Skip to content

Create, Update and Deploy Virtual Service before a test

sachinmaske edited this page Oct 17, 2022 · 1 revision

This example explains how to Create, Update and Deploy Virtual service for a single test case.

@DevTestVirtualServer(deployServiceToVse = "VSE",groupName="V3UpdateTest")
public class VirtualServiceV3UpdateTest {

    @Rule
    public VirtualServicesRule rules = new VirtualServicesRule();

    /**
     * Create, Update and Deploy VS with new RRPair
     */
    @DevTestVirtualServicesV3 (
        value = {@DevTestVirtualServiceV3(
                serviceName = "vsV3_Deploy",
                port = "24778",
                workingFolder = "v3/rrpair",
                inputFile2 = "operation-8-req.txt",
                inputFile1 = "operation-8-rsp.txt"
        ),
        @DevTestVirtualServiceV3(
                serviceName = "vsV3_Deploy",
                workingFolder = "v3/rrpair",
                inputFile2 = "operation-9-req.txt",
                inputFile1 = "operation-9-rsp.txt",
                type = VirtualServiceV3Type.UPDATE
        )}
    )
    @Test
    public void vsV3_Deploy(){
        ResponseParser op8Response = HttpUtils.GET(HttpUtils.URL_FORMAT, "http", "localhost",
                "24778","import/test/operation-8");
        ResponseParser op9Response = HttpUtils.GET(HttpUtils.URL_FORMAT, "http", "localhost",
                "24778", "import/test/operation-9");
        assert (op8Response!=null);
        assert (op8Response.getValue("$.TCEntry[0].termsType").equals("Operation 8 terms"));
        assert (op9Response != null);
        assert (op9Response.getValue("$.TCEntry[0].termsType").equals("Operation 9 terms"));
    }
}

Getting Started

Code Library

Core Functionality

Version 1.4.0

Annotation DevTestVirtualServiceV3

Version 1.3.2

Acknowledgments

Clone this wiki locally