BAEL-4783 remove old dir
This commit is contained in:
		
							parent
							
								
									af9cc0deb9
								
							
						
					
					
						commit
						febcc44ea8
					
				| @ -1,172 +0,0 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
| 
 | ||||
| 
 | ||||
|     <parent> | ||||
|         <groupId>com.baeldung</groupId> | ||||
|         <artifactId>parent-boot-2</artifactId> | ||||
|         <version>0.0.1-SNAPSHOT</version> | ||||
|         <relativePath>../../parent-boot-2</relativePath> | ||||
|         <!-- lookup parent from repository --> | ||||
|     </parent> | ||||
| 
 | ||||
|     <properties> | ||||
|         <maven.compiler.source>11</maven.compiler.source> | ||||
|         <maven.compiler.target>11</maven.compiler.target> | ||||
|         <cucumber.version>6.9.1</cucumber.version> | ||||
|         <cucumber-reporting.version>5.4.0</cucumber-reporting.version> | ||||
|         <selenium.version>3.141.59</selenium.version> | ||||
|         <webdrivermanager.version>4.3.1</webdrivermanager.version> | ||||
|         <webjars-locator.version>0.40</webjars-locator.version> | ||||
|         <jquery.version>3.0.0</jquery.version> | ||||
|         <bootstrap.version>4.5.3</bootstrap.version> | ||||
|     </properties> | ||||
| 
 | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|     <artifactId>spring-junit5-cucumber</artifactId> | ||||
|     <dependencies> | ||||
|         <dependency> | ||||
|             <groupId>org.springframework.boot</groupId> | ||||
|             <artifactId>spring-boot-starter-web</artifactId> | ||||
|         </dependency> | ||||
| 
 | ||||
|         <dependency> | ||||
|             <groupId>org.springframework.boot</groupId> | ||||
|             <artifactId>spring-boot-starter-thymeleaf</artifactId> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.webjars</groupId> | ||||
|             <artifactId>webjars-locator</artifactId> | ||||
|             <version>${webjars-locator.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.webjars.npm</groupId> | ||||
|             <artifactId>jquery-slim</artifactId> | ||||
|             <version>${jquery.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.webjars</groupId> | ||||
|             <artifactId>bootstrap</artifactId> | ||||
|             <version>${bootstrap.version}</version> | ||||
|         </dependency> | ||||
| 
 | ||||
| 
 | ||||
|         <dependency> | ||||
|             <groupId>org.projectlombok</groupId> | ||||
|             <artifactId>lombok</artifactId> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>io.cucumber</groupId> | ||||
|             <artifactId>cucumber-java</artifactId> | ||||
|             <version>${cucumber.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>io.cucumber</groupId> | ||||
|             <artifactId>cucumber-junit-platform-engine</artifactId> | ||||
|             <version>${cucumber.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>io.cucumber</groupId> | ||||
|             <artifactId>cucumber-spring</artifactId> | ||||
|             <version>${cucumber.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.seleniumhq.selenium</groupId> | ||||
|             <artifactId>selenium-java</artifactId> | ||||
|             <version>${selenium.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.seleniumhq.selenium</groupId> | ||||
|             <artifactId>selenium-support</artifactId> | ||||
|             <version>${selenium.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>io.github.bonigarcia</groupId> | ||||
|             <artifactId>webdrivermanager</artifactId> | ||||
|             <version>${webdrivermanager.version}</version> | ||||
|             <scope>test</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>io.rest-assured</groupId> | ||||
|             <artifactId>spring-mock-mvc</artifactId> | ||||
|             <version>${rest-assured.version}</version> | ||||
|             <scope>test</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>io.rest-assured</groupId> | ||||
|             <artifactId>json-schema-validator</artifactId> | ||||
|             <version>${rest-assured.version}</version> | ||||
|             <scope>test</scope> | ||||
|         </dependency> | ||||
|     </dependencies> | ||||
| 
 | ||||
|     <build> | ||||
|         <pluginManagement> | ||||
|             <plugins> | ||||
|                 <plugin> | ||||
|                     <groupId>net.masterthought</groupId> | ||||
|                     <artifactId>maven-cucumber-reporting</artifactId> | ||||
|                     <version>${cucumber-reporting.version}</version> | ||||
|                     <configuration> | ||||
|                         <projectName>randomnumbergenerator</projectName> | ||||
|                         <outputDirectory> | ||||
|                             ${project.build.directory} | ||||
|                         </outputDirectory> | ||||
|                         <inputDirectory> | ||||
|                             ${project.build.directory}/cucumber | ||||
|                         </inputDirectory> | ||||
|                         <classificationFiles>**/*.properties</classificationFiles> | ||||
|                         <jsonFiles> | ||||
|                             <param>**/*.json</param> | ||||
|                         </jsonFiles> | ||||
|                     </configuration> | ||||
|                 </plugin> | ||||
|             </plugins> | ||||
|         </pluginManagement> | ||||
|     </build> | ||||
| 
 | ||||
|     <profiles> | ||||
|         <profile> | ||||
|             <id>acceptance</id> | ||||
|             <activation> | ||||
|                 <activeByDefault>false</activeByDefault> | ||||
|             </activation> | ||||
|             <build> | ||||
|                 <plugins> | ||||
|                     <plugin> | ||||
|                         <groupId>org.apache.maven.plugins</groupId> | ||||
|                         <artifactId>maven-failsafe-plugin</artifactId> | ||||
|                         <version>${maven-failsafe-plugin.version}</version> | ||||
|                         <configuration> | ||||
|                             <includes> | ||||
|                                 <include>**/*IT.java</include> | ||||
|                             </includes> | ||||
|                         </configuration> | ||||
|                         <goals> | ||||
|                             <goal>integration-test</goal> | ||||
|                             <goal>verify</goal> | ||||
|                         </goals> | ||||
|                     </plugin> | ||||
|                     <plugin> | ||||
|                         <groupId>net.masterthought</groupId> | ||||
|                         <artifactId>maven-cucumber-reporting</artifactId> | ||||
|                         <executions> | ||||
|                             <execution> | ||||
|                                 <id>execution</id> | ||||
|                                 <phase>post-integration-test</phase> | ||||
|                                 <goals> | ||||
|                                     <goal>generate</goal> | ||||
|                                 </goals> | ||||
|                             </execution> | ||||
|                         </executions> | ||||
|                     </plugin> | ||||
|                 </plugins> | ||||
|             </build> | ||||
|         </profile> | ||||
| 
 | ||||
|     </profiles> | ||||
| 
 | ||||
| </project> | ||||
| @ -1,38 +0,0 @@ | ||||
| package com.baeldung.cucumber_tags.controller; | ||||
| 
 | ||||
| import com.baeldung.cucumber_tags.service.RandomNumberGeneratorService; | ||||
| import lombok.AllArgsConstructor; | ||||
| import lombok.Data; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.ui.Model; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.ModelAttribute; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| 
 | ||||
| 
 | ||||
| @Controller | ||||
| @AllArgsConstructor | ||||
| public class UiController { | ||||
| 
 | ||||
|     @GetMapping("/random-number-generator") | ||||
|     public String showForm(Model model) { | ||||
|         RandomNumberQuery randomNumberQuery = new RandomNumberQuery(); | ||||
|         model.addAttribute("randomNumberQuery", randomNumberQuery); | ||||
| 
 | ||||
|         return "random-number-generator"; | ||||
|     } | ||||
| 
 | ||||
|     @PostMapping(value = "/random-number-generator") | ||||
|     public String generateRandomNumber(@ModelAttribute("randomNumberQuery") final RandomNumberQuery randomNumberQuery) { | ||||
|         RandomNumberGeneratorService service = new RandomNumberGeneratorService(); | ||||
|         randomNumberQuery.randomNumber = service.generateRandomNumber(randomNumberQuery.min, randomNumberQuery.max); | ||||
|         return "random-number-generator"; | ||||
| } | ||||
| 
 | ||||
|     @Data | ||||
|     private static class RandomNumberQuery { | ||||
|         Integer min = null; | ||||
|         Integer max = null; | ||||
|         Integer randomNumber = null; | ||||
|     } | ||||
| } | ||||
| @ -1,77 +0,0 @@ | ||||
| package com.baeldung.cucumber_tags.acceptance.commonutil; | ||||
| 
 | ||||
| import org.openqa.selenium.WebDriver; | ||||
| import org.openqa.selenium.chrome.ChromeDriver; | ||||
| import org.openqa.selenium.remote.DesiredCapabilities; | ||||
| import org.openqa.selenium.remote.RemoteWebDriver; | ||||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.context.annotation.Scope; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import java.net.URL; | ||||
| 
 | ||||
| import static io.github.bonigarcia.wdm.WebDriverManager.getInstance; | ||||
| import static io.github.bonigarcia.wdm.config.DriverManagerType.CHROME; | ||||
| 
 | ||||
| @Component | ||||
| @Scope(scopeName = "cucumber-glue") | ||||
| public class ScenarioContextUI { | ||||
| 
 | ||||
|     protected static final String RANDOM_NUMBER_URL = "/random-number-generator"; | ||||
| 
 | ||||
|     @LocalServerPort | ||||
|     int port; | ||||
|     private WebDriver driver; | ||||
|     private ScenarioReport report; | ||||
| 
 | ||||
|     public ScenarioContextUI() { | ||||
|         reset(); | ||||
|     } | ||||
| 
 | ||||
|     private void reset() { | ||||
|         report = new ScenarioReport(); | ||||
|         driver = null; | ||||
|     } | ||||
| 
 | ||||
|     private static WebDriver getRemoteWebDriver(URL url) { | ||||
|         return new RemoteWebDriver(url, DesiredCapabilities.chrome()); | ||||
|     } | ||||
| 
 | ||||
|     private static WebDriver getLocalChromeDriver() { | ||||
|         getInstance(CHROME).setup(); | ||||
|         return new ChromeDriver(); | ||||
|     } | ||||
| 
 | ||||
|     public ScenarioReport getReport() { | ||||
|         return report; | ||||
|     } | ||||
| 
 | ||||
|     public String getRandomNumberUrl() { | ||||
|         return "http://" + getServiceBaseUrl() + RANDOM_NUMBER_URL; | ||||
|     } | ||||
| 
 | ||||
|     private String getServiceBaseUrl() { | ||||
|         return CucumberEnvironment.getServiceHost() + ":" + Integer.toString(port); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * If we are running inside docker (mostly for gitlab ci purposes), we expect a selenium grid setup. | ||||
|      * If that environment variable isn't set, we assume we're in "dev mode" and ChromeDriverManager will | ||||
|      * provide the local instance of chromedriver (no need to have chromedriver installed). | ||||
|      */ | ||||
|     public WebDriver getWebDriver() { | ||||
|         if (driver == null) { | ||||
|             return getFreshWebdriver(); | ||||
|         } else { | ||||
|             return driver; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private WebDriver getFreshWebdriver() { | ||||
|         driver = CucumberEnvironment.getSeleniumGridUrl() | ||||
|             .map(ScenarioContextUI::getRemoteWebDriver) | ||||
|             .orElseGet(ScenarioContextUI::getLocalChromeDriver); | ||||
|         return driver; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user