<?xml version="1.0"?>
<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">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.graphql-java-generator</groupId>
		<artifactId>graphql-maven-plugin-samples</artifactId>
		<version>1.0</version>
	</parent>

	<artifactId>graphql-maven-plugin-samples-Basic-client</artifactId>

	<build>
		<plugins>
			<plugin>
				<groupId>com.graphql-java-generator</groupId>
				<artifactId>graphql-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>graphql</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<mode>client</mode>
				</configuration>
			</plugin>
			<plugin>
				<!-- Execution of the integration tests -->
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>integration-test</goal>
							<goal>verify</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<!-- This plugin allows to start the SpringBoot Forum-server in the background during the integration tests -->
				<groupId>com.bazaarvoice.maven.plugins</groupId>
				<artifactId>process-exec-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>switchboard-process</id>
						<phase>pre-integration-test</phase>
						<goals>
							<goal>start</goal>
						</goals>
						<configuration>
							<name>Basic sample GraphQL server</name>
							<workingDir>basic_graphql_server</workingDir>
							<waitForInterrupt>false</waitForInterrupt>
							<healthcheckUrl>http://localhost:8180/graphiql</healthcheckUrl>
							<arguments>
								<argument>java</argument>
								<argument>-jar</argument>
								<argument>${basedir}/../graphql-maven-plugin-samples-Basic-server/target/graphql-maven-plugin-samples-Basic-server-${project.version}.jar</argument>
							</arguments>
						</configuration>
					</execution>
					<!--Stop all processes in reverse order -->
					<execution>
						<id>stop-all</id>
						<phase>post-integration-test</phase>
						<goals>
							<goal>stop-all</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<!-- We don't want to spam the repository with test/sample artefacts -->
				<artifactId>maven-deploy-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<!-- Dependencies for tests -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.graphql-java-generator</groupId>
			<artifactId>graphql-maven-plugin-samples-Basic-server</artifactId>
			<scope>test</scope>
		</dependency>


		<!-- Dependencies for GraphQL -->
		<dependency>
			<groupId>com.graphql-java-generator</groupId>
			<artifactId>graphql-java-client-dependencies</artifactId>
			<type>pom</type>
		</dependency>
	</dependencies>

</project>
