chore: update
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.drinkool</groupId>
|
||||
<artifactId>drinkool</artifactId>
|
||||
<version>1.5.15</version>
|
||||
<version>1.5.16</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.drinkool;
|
||||
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
|
||||
@Path("/hello")
|
||||
public class GreetingResource {
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String hello() {
|
||||
return "Hello from Quarkus REST";
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.drinkool;
|
||||
|
||||
import io.quarkus.runtime.StartupEvent;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.enterprise.event.Observes;
|
||||
import org.eclipse.microprofile.reactive.messaging.Channel;
|
||||
import org.eclipse.microprofile.reactive.messaging.Emitter;
|
||||
import org.eclipse.microprofile.reactive.messaging.Incoming;
|
||||
import org.eclipse.microprofile.reactive.messaging.Outgoing;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ApplicationScoped
|
||||
public class MyMessagingApplication {
|
||||
|
||||
/**
|
||||
* Injects an emitter to send messages to the "words-out" channel.
|
||||
*/
|
||||
@Channel("words-out")
|
||||
Emitter<String> emitter;
|
||||
|
||||
/**
|
||||
* Sends message to the "words-out" channel, can be used from a JAX-RS resource or any bean of your application.
|
||||
* Messages are sent to the broker.
|
||||
**/
|
||||
void onStart(@Observes StartupEvent ev) {
|
||||
Stream.of("Hello", "with", "Quarkus", "Messaging", "message").forEach(string -> emitter.send(string));
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume the message from the "words-in" channel, uppercase it and send it to the uppercase channel.
|
||||
* This method is called by the framework when a message is received on the "words-in" channel (from the broker).
|
||||
**/
|
||||
@Incoming("words-in")
|
||||
@Outgoing("uppercase")
|
||||
public String toUpperCase(String message) {
|
||||
return message.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume the uppercase channel (coming from within the application) and print the messages to the console.
|
||||
**/
|
||||
@Incoming("uppercase")
|
||||
public void sink(String word) {
|
||||
System.out.println(">> " + word);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.drinkool;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusIntegrationTest;
|
||||
|
||||
@QuarkusIntegrationTest
|
||||
class GreetingResourceIT extends GreetingResourceTest {
|
||||
// Execute the same tests but in packaged mode.
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.drinkool;
|
||||
|
||||
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
|
||||
class GreetingResourceTest {
|
||||
@Test
|
||||
void testHelloEndpoint() {
|
||||
given()
|
||||
.when().get("/hello")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(is("Hello from Quarkus REST"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.drinkool;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@QuarkusTest
|
||||
class MyMessagingApplicationTest {
|
||||
|
||||
@Inject
|
||||
MyMessagingApplication application;
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
assertEquals("HELLO", application.toUpperCase("Hello"));
|
||||
assertEquals("BONJOUR", application.toUpperCase("bonjour"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user