-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fadfa8b
commit b98e496
Showing
9 changed files
with
111 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Qodana | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
qodana: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: 'Qodana Scan' | ||
uses: JetBrains/qodana-action@v2023.3 | ||
env: | ||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#-------------------------------------------------------------------------------# | ||
# Qodana analysis is configured by qodana.yaml file # | ||
# https://www.jetbrains.com/help/qodana/qodana-yaml.html # | ||
#-------------------------------------------------------------------------------# | ||
version: "1.0" | ||
|
||
#Specify inspection profile for code analysis | ||
profile: | ||
name: qodana.starter | ||
|
||
#Enable inspections | ||
#include: | ||
# - name: <SomeEnabledInspectionId> | ||
|
||
#Disable inspections | ||
#exclude: | ||
# - name: <SomeDisabledInspectionId> | ||
# paths: | ||
# - <path/where/not/run/inspection> | ||
|
||
projectJDK: 21 #(Applied in CI/CD pipeline) | ||
|
||
#Execute shell command before Qodana execution (Applied in CI/CD pipeline) | ||
#bootstrap: sh ./prepare-qodana.sh | ||
|
||
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) | ||
#plugins: | ||
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com) | ||
|
||
#Specify Qodana linter for analysis (Applied in CI/CD pipeline) | ||
linter: jetbrains/qodana-jvm:latest |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/serhatacar/flightsearchapi/entity/Airport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
src/main/java/com/serhatacar/flightsearchapi/repository/AirportRepo.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/main/java/com/serhatacar/flightsearchapi/repository/AirportRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.serhatacar.flightsearchapi.repository; | ||
|
||
import com.serhatacar.flightsearchapi.entity.Airport; | ||
import com.serhatacar.flightsearchapi.entity.Flight; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface AirportRepository extends JpaRepository<Airport, Integer> { | ||
List<Airport> findAirportsByArrivalFlightsContains(Flight flight); | ||
List<Airport> findAirportsByDepartureFlightsContains(Flight flight); | ||
} |
7 changes: 0 additions & 7 deletions
7
src/main/java/com/serhatacar/flightsearchapi/repository/FlightRepo.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/main/java/com/serhatacar/flightsearchapi/repository/FlightRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.serhatacar.flightsearchapi.repository; | ||
|
||
import com.serhatacar.flightsearchapi.entity.Airport; | ||
import com.serhatacar.flightsearchapi.entity.Flight; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface FlightRepository extends JpaRepository<Flight, Integer> { | ||
List < Flight > findByArrivalAirport(Airport airport); | ||
List < Flight > findByDepartureAirport(Airport airport); | ||
} |
32 changes: 27 additions & 5 deletions
32
src/test/java/com/serhatacar/flightsearchapi/FlightsearchapiApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
package com.serhatacar.flightsearchapi; | ||
|
||
import com.serhatacar.flightsearchapi.entity.Flight; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.web.client.TestRestTemplate; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@SpringBootTest | ||
import java.time.LocalDateTime; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
class FlightsearchapiApplicationTests { | ||
|
||
@Test | ||
void contextLoads() { | ||
} | ||
@Autowired | ||
private TestRestTemplate restTemplate; | ||
|
||
@Test | ||
void testCreateFlight() { | ||
Flight flight = new Flight(); | ||
flight.setDepartureDateTime(LocalDateTime.now()); | ||
flight.setArrivalDateTime(LocalDateTime.now().plusDays(1)); | ||
flight.setPrice(100.0); | ||
|
||
ResponseEntity<Flight> response = restTemplate.postForEntity("/flights", flight, Flight.class); | ||
|
||
assertEquals(HttpStatus.CREATED, response.getStatusCode()); | ||
assertEquals(flight.getPrice(), response.getBody().getPrice()); | ||
} | ||
|
||
|
||
} | ||
} |