Commit f559c804 authored by SR-Lut3t1um's avatar SR-Lut3t1um

started working

parent 395c0e88
Pipeline #88768 passed with stages
in 3 minutes and 25 seconds
......@@ -20,7 +20,6 @@ before_script:
include:
- template: Dependency-Scanning.gitlab-ci.yml
- template: SAST.gitlab-ci.yml
build:
......
......@@ -15,6 +15,7 @@ dependencies {
implementation 'io.quarkus:quarkus-hibernate-orm'
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-resteasy'
implementation 'io.quarkus:quarkus-resteasy-qute'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
......
package org.un1q3e;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/hello")
public class ExampleResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "hello";
}
}
\ No newline at end of file
package org.un1qu3.endpoints;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateInstance;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.un1qu3.models.Automaton;
@Path("/automaton")
public class AutomatonResource {
@SuppressWarnings("CdiInjectionPointsInspection")
@Inject
Template automaton;
@GET
@Path("{name}")
@Produces(MediaType.TEXT_HTML)
public TemplateInstance get(@PathParam("name") String name) {
return automaton.data("automaton", new Automaton(name));
}
}
\ No newline at end of file
package org.un1qu3.models;
public class Automaton {
public String name;
public Automaton(String name) {
this.name = name;
}
}
......@@ -130,7 +130,7 @@
<div class="right-section">
<h3>Application</h3>
<ul>
<li>GroupId: org.un1q3e</li>
<li>GroupId: org.un1qu3</li>
<li>ArtifactId: machine</li>
<li>Version: 1.0.0-SNAPSHOT</li>
<li>Quarkus Version: 1.2.0.Final</li>
......
{@org.un1qu3.models.Automaton automaton}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{automaton.name}</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
package org.un1q3e;
package org.un1qu3;
import io.quarkus.test.junit.NativeImageTest;
@NativeImageTest
public class NativeExampleResourceIT extends ExampleResourceTest {
public class NativeAutomatonResourceIT extends AutomatonResourceTest {
// Execute the same tests but in native mode.
}
\ No newline at end of file
package org.un1q3e;
package org.un1qu3;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
@QuarkusTest
public class ExampleResourceTest {
public class AutomatonResourceTest {
@Test
public void testHelloEndpoint() {
given()
.when().get("/hello")
.when().get("/automaton/qwe")
.then()
.statusCode(200)
.body(is("hello"));
.statusCode(200);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment