Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,35 @@ jobs:
- name: Test and package
run: ./mvnw --batch-mode --no-transfer-progress verify

- name: Validate API proof asset
run: |
test -s docs/library-api-error-proof.jpg
python3 - <<'PY'
from pathlib import Path

proof = Path("docs/library-api-error-proof.jpg").read_bytes()
assert proof[:2] == b"\xff\xd8", "proof asset is not a JPEG"

offset = 2
dimensions = None
start_of_frame = {0xC0, 0xC1, 0xC2, 0xC3, 0xC5, 0xC6, 0xC7, 0xC9, 0xCA, 0xCB, 0xCD, 0xCE, 0xCF}
while offset < len(proof):
assert proof[offset] == 0xFF, "invalid JPEG marker"
marker = proof[offset + 1]
offset += 2
if marker in {0xD8, 0xD9}:
continue
length = int.from_bytes(proof[offset:offset + 2], "big")
if marker in start_of_frame:
height = int.from_bytes(proof[offset + 3:offset + 5], "big")
width = int.from_bytes(proof[offset + 5:offset + 7], "big")
dimensions = (width, height)
break
offset += length

assert dimensions == (1280, 720), "proof asset must be 1280x720"
PY

- name: Validate Compose contract
run: docker compose --env-file .env.example config --quiet

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Kütüphaneler tarafından kullanılabilecek kayıt yönetimlerini, kitap ödün
- Java 17'ye sabitlenmiş container build/runtime aşamaları ve PostgreSQL servis sağlık kontrolü.
- Kaynakta parola tutmayan Compose yapılandırması ve Java 17/PostgreSQL CI doğrulaması.

## Canlı API Kanıtı

![Swagger UI'da var olmayan kategori isteğinin global hata yönetimiyle 404 dönmesi](docs/library-api-error-proof.jpg)

*Gerçek Java 17/PostgreSQL 16 container çalıştırmasından alınmıştır. Swagger UI, `DataLoader` tarafından üretilen sentetik yerel veriler üzerinde `GET /api/v1/categories/999999` isteğini çalıştırır; fork'ta eklenen global hata yönetimi de tam 404 yanıtını üretir. Bu, barındırılan bir demo değil, yerel ve tekrar üretilebilir bir çalışma kanıtıdır.*

## Kullanılan Teknolojiler

<code><img width="50" src="https://user-images.githubusercontent.com/25181517/117201156-9a724800-adec-11eb-9a9d-3cd0f67da4bc.png" alt="Java" title="Java"/></code>
Expand Down
Binary file added docs/library-api-error-proof.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.alisimsek.LibraryManagementProject;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@SpringBootTest
@AutoConfigureMockMvc
class CategoryErrorResponseIntegrationTests {

@Autowired
private MockMvc mockMvc;

@Test
void missingCategoryUsesTheForksGlobalErrorResponse() throws Exception {
mockMvc.perform(get("/api/v1/categories/{id}", 999999L))
.andExpect(status().isNotFound())
.andExpect(content().string("Category with ID 999999 not found in the system."));
}
}
Loading