Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

creating a PR - after adding all - Test Automation Design patterns with all 4 modules #72

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3352c58
builder pattern implementation with TestNg & Exercises-1
abhinay5993 Jan 31, 2024
17cd76b
adding solutions for Mandatory,Optional fields Excercise-1 , Excercis…
abhinay5993 Feb 3, 2024
fc60856
expansion.serenity course 'Essential Design Patterns for Test Automat…
abhinay5993 Feb 6, 2024
61d8ca4
adding depedency for hamcrest matchers
abhinay5993 Feb 7, 2024
b77979d
Vet Clinic Tutorial 2 - Hamcrest Matchers - assignments Step 1 , Step…
abhinay5993 Feb 8, 2024
5a1f6ec
test script implementation for 'Vet Clinic Tutorial 2 - Hamcrest Matc…
abhinay5993 Feb 13, 2024
07dab3f
Working with Enumerations - Step 1,Step 2,Step 3 and Coding Kata - a …
abhinay5993 Feb 22, 2024
8856dba
Collections Katas - Booking pets into a pet hotel - Working with coll…
abhinay5993 Feb 25, 2024
47d2762
organizing by segregetting into new packages under both src/main/java…
abhinay5993 Feb 25, 2024
fc01bfb
modifyed the pom.xml with surefire pluggin entry line no-71
abhinay5993 Feb 25, 2024
4aee7ef
adding strtegy with Functions+Strategy pattern initial test codes.
abhinay5993 Feb 27, 2024
bb5c5bc
added new componets into strategy implementations
abhinay5993 Feb 28, 2024
e77c7fb
Vet Clinic Tutorial Project - strategy,strategy-pattern implementatio…
abhinay5993 Feb 29, 2024
b407884
adding .ignore file for test-output
abhinay5993 Feb 29, 2024
7432494
Merge branch 'tutorial-2/express-hamcrest/matchersExercises-solution'
abhinay5993 Feb 29, 2024
0dd0085
Merge branch 'kata/strategy-pattern/solutions'
abhinay5993 Feb 29, 2024
b0eb31f
Created maven-publish.yml to work with GitHub actions for automated d…
abhinay5993 Feb 29, 2024
635ae1f
modifyed the version of POM.xml for git-hub actions
abhinay5993 Feb 29, 2024
ff44ec5
Merge branch 'master' of https://github.com/abhinay5993/vet-clinic
abhinay5993 Feb 29, 2024
cee787d
fixing the failed TC's from TestNg xml suite and modifyed pom.xml
abhinay5993 Feb 29, 2024
4559ae7
updated the JDK version in pom.xml file
abhinay5993 Feb 29, 2024
2dc103c
updated the POM.xml artifact version with newly added dependencies
abhinay5993 Feb 29, 2024
171943e
adding the changes to pom.xml dependency
abhinay5993 Feb 29, 2024
dc437df
[maven-release-plugin] prepare release vet-clinic-1.0
abhinay5993 Feb 29, 2024
3e04ada
[maven-release-plugin] prepare for next development iteration
abhinay5993 Feb 29, 2024
ef30f2d
[maven-release-plugin] prepare release vet-clinic-1.1
abhinay5993 Feb 29, 2024
ebe8a74
[maven-release-plugin] prepare for next development iteration
abhinay5993 Feb 29, 2024
e3e1f6f
updated the POM.xml depedency for release
abhinay5993 Feb 29, 2024
033f41b
[maven-release-plugin] prepare release vet-clinic-1.2
abhinay5993 Feb 29, 2024
3261165
[maven-release-plugin] prepare for next development iteration
abhinay5993 Feb 29, 2024
9459d0c
reverting the app version to v1.0.0
abhinay5993 Feb 29, 2024
8f1f12e
[maven-release-plugin] prepare release vet-clinic-1.0.0
abhinay5993 Feb 29, 2024
2c25758
[maven-release-plugin] prepare for next development iteration
abhinay5993 Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Maven Package

on:
push:
brabranches: [master]

release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Created by .ignore support plugin (hsz.mobi)
### Maven template
target/
test-output/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
Expand Down
1 change: 1 addition & 0 deletions RunTestSuite.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mvn clean test
1 change: 1 addition & 0 deletions RunTestSuite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mvn clean test
168 changes: 118 additions & 50 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,56 +1,124 @@
<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>
<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>

<groupId>com.wakaleo.tutorials</groupId>
<artifactId>vet-clinic</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<groupId>com.wakaleo.tutorials</groupId>
<artifactId>vet-clinic</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tutorials</name>
<url>http://maven.apache.org</url>

<name>tutorials</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub abhinay5993 Apache Maven Packages</name>
<url>https://maven.pkg.github.com/abhinay5993/vet-clinic</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<developers>
<developer>
<name>abhinay5993</name>
<email>[email protected]</email>
<organizationUrl>https://github.com/abhinay5993/vet-clinic</organizationUrl>
</developer>
</developers>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<scm>
<connection>scm:git:git://github.com/abhinay5993/vet-clinic.git</connection>
<developerConnection>scm:git:https://github.com/abhinay5993/vet-clinic.git</developerConnection>
<url>https://github.com/abhinay5993/vet-clinic</url>
<tag>vet-clinic-autodeployed-v</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<defaultSuiteXmlFile>src/test/resources/testSuites/TestNgTCs_Executions_TestSuite.xml</defaultSuiteXmlFile></suiteXmlFiles>
<includes>
<include>**/When*.java</include>
<include>**/*Tests.java</include>
<include>**/*TestSuite.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/When*.java</include>
<include>**/*Test.java</include>
<include>**/*TestSuite.java</include>
</includes>
</configuration>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
</build>
</project>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;

public interface BookingAcknowledgement {

boolean isConfirmed();

boolean isOnWaitingList();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;
import serenitylabs.tutorials.vetclinic.katas.PetEntity;

public class BookingConfirmation extends BookingResponse{

public BookingConfirmation(int number, PetEntity pet) {
super(number, pet);
}

@Override
public boolean isConfirmed() {
return true;
}

@Override
public boolean isOnWaitingList() {
return false;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;
import java.util.concurrent.atomic.AtomicInteger;
import serenitylabs.tutorials.vetclinic.katas.PetEntity;

public abstract class BookingResponse implements BookingAcknowledgement {

private static AtomicInteger bookingNumberCounter = new AtomicInteger();
private final int number;
private final PetEntity pet;

public BookingResponse(int number, PetEntity pet) {
this.number = number;
this.pet = pet;
}

public static BookingResponse confirmedFor(PetEntity pet) {
return new BookingConfirmation(bookingNumberCounter.incrementAndGet(), pet);
}

public static BookingResponse waitingListFor(PetEntity pet) {
return new PlacedOnWaitingList(bookingNumberCounter.incrementAndGet(), pet);
}

/**
* @return the number
*/
public int getNumber() {
return number;
}

/**
* @return the pet
*/
public PetEntity getPet() {
return pet;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;

public class Calculator {

protected int field;

public Integer calculate(String expression) {
return 0;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;
import serenitylabs.tutorials.vetclinic.katas.PetEntity;

public interface CheckInStrategy {

BookingResponse attemptToCheckIn(PetEntity pet);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;
import java.util.Collection;
import serenitylabs.tutorials.vetclinic.katas.PetEntity;

public class ConfirmBookingStrategy implements CheckInStrategy {

private final Collection<PetEntity> pets;

public ConfirmBookingStrategy(Collection<PetEntity> pets) {
this.pets = pets;
}

@Override
public BookingResponse attemptToCheckIn(PetEntity pet) {
pets.add(pet);
return BookingResponse.confirmedFor(pet);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;

public enum HotelAvailability {

Available, Full;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;
import serenitylabs.tutorials.vetclinic.katas.PetEntity;

public class PlacedOnWaitingList extends BookingResponse {

public PlacedOnWaitingList(int number, PetEntity pet) {
super(number, pet);
}

@Override
public boolean isConfirmed() {
return false;
}

@Override
public boolean isOnWaitingList() {
return true;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package serenitylabs.tutorials.vetclinic.collections.exercises;
import java.util.ArrayList;
import java.util.List;

public class SpecialisedPetHotel<T> {

List<T> pets = new ArrayList<>();

/**
* @return the pets
*/
public List<T> getPets() {
return new ArrayList<>(pets);
}

/**
* @param pets the pets to set
*/
public void checkIn(T pets) {
this.pets.add(pets);
}
}
Loading