This repository was archived by the owner on Oct 9, 2025. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 5
Create and Deploy Multiple Virtual Services Before a Test
        sachinmaske edited this page Oct 20, 2022 
        ·
        1 revision
      
    This example explains how multiple virtual services can be created for a single test case.
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = LisaBankClientApplication.class)
@DevTestVirtualServer()
public class AccountServiceTest {
	@Autowired
	private BankService bankServices;
	
	// Rule to handle Class scope Devtest Annotations
	@ClassRule
	public static VirtualServiceClassScopeRule ruleClass= new VirtualServiceClassScopeRule();
	// Rule to handle Method scope Devtest Annotations
	@Rule
	public VirtualServicesRule rules = new VirtualServicesRule();
	@DevTestVirtualServiceV3(serviceName = "UserServiceTest-EJB3UserControlBean",
			port = "9081",
			basePath = "/itkoExamples/EJB3UserControlBean",
			workingFolder = "AccountServiceTest/createUserWithCheckingAccount/v3/EJB3UserControlBean",
			inputFile1 = "rrpair.zip",
			dataProtocolsConfig = {
				@DataProtocolConfig(
					typeId = "SOAPDPH"
				)
			}
	)
	@DevTestVirtualServiceV3(serviceName = "UserServiceTest-EJB3AccountControlBean",
			port = "9081",
			basePath = "/itkoExamples/EJB3AccountControlBean",
			workingFolder = "AccountServiceTest/createUserWithCheckingAccount/v3/EJB3AccountControlBean",
			inputFile1 = "rrpair.zip",
			dataProtocolsConfig = {
				@DataProtocolConfig(
					typeId = "SOAPDPH"
				)
			}
	)
	@Test
	public void createUserWithCheckingAccountV3() {
		// Given
		String user = "pascal";
		String password = "password";
		int amount = 1000;
		// prepare context
		// bankServices.deleteUser(user);
		// When
		Account account = bankServices.createUserWithCheckingAccount(user, password, amount);
		// Then
		assertNotNull(account);
		assertEquals("Le balance du compte n'est pas conforme", amount, account.getBalance().intValue());
	}
}Annotation DevTestVirtualServiceV3
- Create and Deploy a Virtual Service Before a Test
- Create and Deploy a Virtual Service Before Any Test from the Class
- Create and Deploy Multiple Virtual Services Before a Test
- Create Update and Deploy Virtual Service Before a Test
- Create, Update and Deploy Virtual Service Before any Test from the Class
- Create and Deploy Virtual Service with RR Pair
- Create and Deploy Virtual Service with RR Pair Zip File
- Create and Deploy Virtual Service with Swagger File
- Create and Deploy Virtual Service with Swagger Url
- Create and Deploy Virtual Service with RAML File
- Create and Deploy Virtual Service with RAML Url
- Create and Deploy Virtual Service with WADL File
- Create and Deploy Virtual Service with WADL Url
- Create and Deploy Virtual Service with VSM/VSI File
- Create and Deploy Virtual Service and Update Data and Config File
- Create and Deploy Virtual Service with Parameterized VSM File
- Create and Deploy Virtual Service with Parameterized Input File
- Create and Deploy Virtual Service with SSL End-Point
- Create and Deploy a Virtual Service before a Test
- Create and Deploy a Virtual Service before Any Test from the Class
- Create and Deploy Multiple Virtual Services before a Test
- Create and Deploy with VRS
- Create and Deploy with RR Pair
- Create and Deploy with VSM
- Parameterized DevTest Virtual Service Annotation
- Generate RR Pairs Utility