Remove redundant api prefix path
This commit is contained in:
parent
fb2427518d
commit
cae18e206d
@ -17,7 +17,7 @@ import javax.ws.rs.Produces;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
@Path("/api/chats")
|
@Path("/chats")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public class ChatResource {
|
public class ChatResource {
|
||||||
@ -39,7 +39,7 @@ public class ChatResource {
|
|||||||
@POST
|
@POST
|
||||||
public Uni<Response> create(Chat chat) {
|
public Uni<Response> create(Chat chat) {
|
||||||
return Panache.withTransaction(() -> chatRepository.persist(chat))
|
return Panache.withTransaction(() -> chatRepository.persist(chat))
|
||||||
.onItem().transform(inserted -> Response.created(URI.create("/api/" + chat.id)).build());
|
.onItem().transform(inserted -> Response.created(URI.create("/chats/" + chat.id)).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
quarkus.http.port=8282
|
||||||
|
|
||||||
%prod.quarkus.datasource.db-kind=postgresql
|
%prod.quarkus.datasource.db-kind=postgresql
|
||||||
%prod.quarkus.datasource.username=quarkus_test
|
%prod.quarkus.datasource.username=quarkus_test
|
||||||
%prod.quarkus.datasource.password=quarkus_test
|
%prod.quarkus.datasource.password=quarkus_test
|
||||||
|
@ -23,7 +23,7 @@ public class ChatsEndpointTest {
|
|||||||
//List all, should have all 3 usernames the database has initially:
|
//List all, should have all 3 usernames the database has initially:
|
||||||
Response response = given()
|
Response response = given()
|
||||||
.when()
|
.when()
|
||||||
.get("/api/chats")
|
.get("/chats")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -35,7 +35,7 @@ public class ChatsEndpointTest {
|
|||||||
.when()
|
.when()
|
||||||
.body("{\"name\" : \"Telegram Official\"}")
|
.body("{\"name\" : \"Telegram Official\"}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.put("/api/chats/777000")
|
.put("/chats/777000")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.body(
|
.body(
|
||||||
@ -45,7 +45,7 @@ public class ChatsEndpointTest {
|
|||||||
//List all, Telegram Official should've replaced Telegram:
|
//List all, Telegram Official should've replaced Telegram:
|
||||||
response = given()
|
response = given()
|
||||||
.when()
|
.when()
|
||||||
.get("/api/chats")
|
.get("/chats")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -56,13 +56,13 @@ public class ChatsEndpointTest {
|
|||||||
//Delete Telegram:
|
//Delete Telegram:
|
||||||
given()
|
given()
|
||||||
.when()
|
.when()
|
||||||
.delete("/api/chats/777000")
|
.delete("/chats/777000")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(204);
|
.statusCode(204);
|
||||||
|
|
||||||
response = given()
|
response = given()
|
||||||
.when()
|
.when()
|
||||||
.get("/api/chats")
|
.get("/chats")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -75,7 +75,7 @@ public class ChatsEndpointTest {
|
|||||||
.when()
|
.when()
|
||||||
.body("{\"id\": \"777001-u\", \"name\" : \"Telegram2\"}")
|
.body("{\"id\": \"777001-u\", \"name\" : \"Telegram2\"}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.post("/api/chats")
|
.post("/chats")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(201)
|
.statusCode(201)
|
||||||
.body(emptyString());
|
.body(emptyString());
|
||||||
@ -83,7 +83,7 @@ public class ChatsEndpointTest {
|
|||||||
//List all, Pineapple should be still missing now:
|
//List all, Pineapple should be still missing now:
|
||||||
response = given()
|
response = given()
|
||||||
.when()
|
.when()
|
||||||
.get("/api/chats")
|
.get("/chats")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.extract().response();
|
.extract().response();
|
||||||
@ -95,7 +95,7 @@ public class ChatsEndpointTest {
|
|||||||
public void testEntityNotFoundForDelete() {
|
public void testEntityNotFoundForDelete() {
|
||||||
given()
|
given()
|
||||||
.when()
|
.when()
|
||||||
.delete("/api/chats/777123")
|
.delete("/chats/777123")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(404)
|
.statusCode(404)
|
||||||
.body(emptyString());
|
.body(emptyString());
|
||||||
@ -107,7 +107,7 @@ public class ChatsEndpointTest {
|
|||||||
.when()
|
.when()
|
||||||
.body("{\"id\": \"777234-u\", \"name\" : \"Juan\"}")
|
.body("{\"id\": \"777234-u\", \"name\" : \"Juan\"}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.put("/api/chats/777234")
|
.put("/chats/777234")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200);
|
.statusCode(200);
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ public class ChatsEndpointTest {
|
|||||||
.when()
|
.when()
|
||||||
.body("{\"name\" : \"Juan\"}")
|
.body("{\"name\" : \"Juan\"}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.put("/api/chats/777234")
|
.put("/chats/777234")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(500);
|
.statusCode(500);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import javax.ws.rs.Path;
|
|||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
@Path("/api/td")
|
@Path("/td")
|
||||||
public class TdResource {
|
public class TdResource {
|
||||||
|
|
||||||
@Inject TdService tdService;
|
@Inject TdService tdService;
|
||||||
|
@ -14,7 +14,7 @@ import javax.ws.rs.PathParam;
|
|||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
@Path("/api/td/session/{sessionId}")
|
@Path("/td/session/{sessionId}")
|
||||||
public class TdSessionResource {
|
public class TdSessionResource {
|
||||||
|
|
||||||
@PathParam("sessionId")
|
@PathParam("sessionId")
|
||||||
|
@ -1,175 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>service-td - 1.0.0-SNAPSHOT</title>
|
|
||||||
<style>
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 2.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 2rem
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 1.75rem
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
font-size: 1.5rem
|
|
||||||
}
|
|
||||||
|
|
||||||
h5 {
|
|
||||||
font-size: 1.25rem
|
|
||||||
}
|
|
||||||
|
|
||||||
h6 {
|
|
||||||
font-size: 1rem
|
|
||||||
}
|
|
||||||
|
|
||||||
.lead {
|
|
||||||
font-weight: 300;
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner {
|
|
||||||
font-size: 2.7rem;
|
|
||||||
margin: 0;
|
|
||||||
padding: 2rem 1rem;
|
|
||||||
background-color: #0d1c2c;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
||||||
font-size: 87.5%;
|
|
||||||
color: #e83e8c;
|
|
||||||
word-break: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
.left-column {
|
|
||||||
padding: .75rem;
|
|
||||||
max-width: 75%;
|
|
||||||
min-width: 55%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-column {
|
|
||||||
padding: .75rem;
|
|
||||||
max-width: 25%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
margin: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-section {
|
|
||||||
margin-left: 1rem;
|
|
||||||
padding-left: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-section h3 {
|
|
||||||
padding-top: 0;
|
|
||||||
font-weight: 200;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-section ul {
|
|
||||||
border-left: 0.3rem solid #71aeef;
|
|
||||||
list-style-type: none;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.provided-code {
|
|
||||||
border-left: 0.3rem solid #71aeef;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.provided-code h3 {
|
|
||||||
font-weight: 200;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="banner lead">
|
|
||||||
Your new Cloud-Native application is ready!
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="left-column">
|
|
||||||
<p class="lead"> Congratulations, you have created a new Quarkus cloud application.</p>
|
|
||||||
|
|
||||||
<h2>What is this page?</h2>
|
|
||||||
|
|
||||||
<p>This page is served by Quarkus. The source is in
|
|
||||||
<code>src/main/resources/META-INF/resources/index.html</code>.</p>
|
|
||||||
|
|
||||||
<h2>What are your next steps?</h2>
|
|
||||||
|
|
||||||
<p>If not already done, run the application in <em>dev mode</em> using: <code>./mvnw compile quarkus:dev</code>.
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li>Your static assets are located in <code>src/main/resources/META-INF/resources</code>.</li>
|
|
||||||
<li>Configure your application in <code>src/main/resources/application.properties</code>.</li>
|
|
||||||
<li>Quarkus now ships with a <a href="/q/dev/">Dev UI</a> (available in dev mode only)</li>
|
|
||||||
<li>Play with the provided code located in <code>src/main/java</code>:</li>
|
|
||||||
</ul>
|
|
||||||
<div class="provided-code">
|
|
||||||
<h3>RESTEasy Reactive</h3>
|
|
||||||
<p>Easily start your Reactive RESTful Web Services</p>
|
|
||||||
<p><code>@Path: <a href="/api/td" class="path-link" target="_blank">/api/td</a></code></p>
|
|
||||||
<p><a href="https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources" class="guide-link" target="_blank">Related guide section...</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="right-column">
|
|
||||||
<div class="right-section">
|
|
||||||
<h3>Application</h3>
|
|
||||||
<ul>
|
|
||||||
<li>GroupId: <code>it.volvox.service-td</code></li>
|
|
||||||
<li>ArtifactId: <code>service-td</code></li>
|
|
||||||
<li>Version: <code>1.0.0-SNAPSHOT</code></li>
|
|
||||||
<li>Quarkus Version: <code>2.4.1.Final</code></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="right-section">
|
|
||||||
<h3>Do you like Quarkus?</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Go give it a star on <a href="https://github.com/quarkusio/quarkus">GitHub</a>.</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="right-section">
|
|
||||||
<h3>Selected extensions guides</h3>
|
|
||||||
<ul>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="right-section">
|
|
||||||
<h3>More reading</h3>
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://quarkus.io/guides/maven-tooling.html" target="_blank">Setup your IDE</a></li>
|
|
||||||
<li><a href="https://quarkus.io/guides/getting-started.html" target="_blank">Getting started</a></li>
|
|
||||||
<li><a href="https://quarkus.io/guides/" target="_blank">All guides</a></li>
|
|
||||||
<li><a href="https://quarkus.io" target="_blank">Quarkus Web Site</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1 +1,3 @@
|
|||||||
|
quarkus.http.port=8283
|
||||||
|
|
||||||
td.requests.timeout = 10s
|
td.requests.timeout = 10s
|
||||||
|
@ -16,7 +16,7 @@ public class TdResourceTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testEmptyList() {
|
public void testEmptyList() {
|
||||||
given()
|
given()
|
||||||
.when().get("/api/td/list")
|
.when().get("/td/list")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.body(is(""));
|
.body(is(""));
|
||||||
@ -25,7 +25,7 @@ public class TdResourceTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testCreateSession() {
|
public void testCreateSession() {
|
||||||
given()
|
given()
|
||||||
.when().get("/api/td/create-session")
|
.when().get("/td/create-session")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.body(not(emptyOrNullString()));
|
.body(not(emptyOrNullString()));
|
||||||
@ -34,7 +34,7 @@ public class TdResourceTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testCreateMultipleSessions() {
|
public void testCreateMultipleSessions() {
|
||||||
var sessionId1 = given()
|
var sessionId1 = given()
|
||||||
.when().get("/api/td/create-session")
|
.when().get("/td/create-session")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.body(not(emptyOrNullString()))
|
.body(not(emptyOrNullString()))
|
||||||
@ -42,7 +42,7 @@ public class TdResourceTest {
|
|||||||
.body()
|
.body()
|
||||||
.asString();
|
.asString();
|
||||||
var sessionId2 = given()
|
var sessionId2 = given()
|
||||||
.when().get("/api/td/create-session")
|
.when().get("/td/create-session")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.body(not(emptyOrNullString()))
|
.body(not(emptyOrNullString()))
|
||||||
@ -53,7 +53,7 @@ public class TdResourceTest {
|
|||||||
var expectedBodyElems = Set.of(sessionId1, sessionId2);
|
var expectedBodyElems = Set.of(sessionId1, sessionId2);
|
||||||
|
|
||||||
var bodyElems = Set.of(given()
|
var bodyElems = Set.of(given()
|
||||||
.when().get("/api/td/list")
|
.when().get("/td/list")
|
||||||
.then()
|
.then()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.extract()
|
.extract()
|
||||||
|
Loading…
Reference in New Issue
Block a user