remove class useless

This commit is contained in:
Valentin CZERYBA 2022-12-28 19:16:13 +01:00
parent e669ee0d55
commit 7b53f48521
5 changed files with 5 additions and 78 deletions

View File

@ -1,17 +0,0 @@
package com.covas.Json;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
public class Hello {
public String msg;
public Hello(){
this.msg = "Hello World";
}
public Hello(String msg){
this.msg = msg;
}
}

View File

@ -7,12 +7,12 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/hello")
@Path("/healthcheck")
public class GreetingResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello RESTEasy";
return "OK";
}
}

View File

@ -1,56 +0,0 @@
package com.covas.Resources;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.covas.Json.Hello;
import org.eclipse.microprofile.jwt.JsonWebToken;
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/json")
public class HelloRessource {
@Inject
JsonWebToken jwt;
Set<Hello> hello = Collections.synchronizedSet(new LinkedHashSet<>());
public HelloRessource(){
hello.add(new Hello("toto"));
}
@GET
@PermitAll
@Produces(MediaType.APPLICATION_JSON)
public Response hello_json(){
return Response.ok(this.hello).build();
}
@GET
@Path("/user")
@RolesAllowed({"User"})
@Produces(MediaType.APPLICATION_JSON)
public Response hello_user(){
return Response.ok(new Hello(String.format("Hello %s", jwt.getName()))).build();
}
@GET
@Path("/admin")
@RolesAllowed({"Admin"})
@Produces(MediaType.APPLICATION_JSON)
public Response hello_admin(){
return Response.ok(new Hello(String.format("Hello admin %s", jwt.getName()))).build();
}
}

View File

@ -1,7 +1,7 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6Y7YVAFp8+ZenWOVE41v
M18eCBsFNASthze6D3mbNS0wOlA2x0LTSt6wZSP8nMRXJmxlptL+X6JWp60aApKW
Y275XXcgE3NablV5/L7SlAbl3yTUC9vK4ksyKd4n35ShFZMLQr8nix01jV0wEygK
Y275XqXcgE3NablV5/L7SlAbl3yTUC9vK4ksyKd4n35ShFZMLQr8nix01jV0wEygK
5kIVhAcEKM8KiEzISsR3AXyiTgb9x8HdEvHpZxy8kc81XetLpQwLVdBpb9PQd/49
Q1fuTUFPYgauyPfe0V+LlXpJJN745P+9XoKOVoUYTEwelk2d88kgp3ZFGOjTcoD3
C9YtAlSrPJy6YK3k2MXjm2P8lw+0pSUBzNIzttFDbejt9dwc2oyPxP29LFIlxGiV

View File

@ -12,10 +12,10 @@ public class GreetingResourceTest {
@Test
public void testHelloEndpoint() {
given()
.when().get("/api/hello")
.when().get("/api/healthcheck")
.then()
.statusCode(200)
.body(is("Hello RESTEasy"));
.body(is("OK"));
}
}