This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@HelidonTest | |
@DisableDiscovery | |
@AddBean(MyBean.class) | |
@AddExtension(ConfigCdiExtension.class) | |
@AddConfig(key = "app.greeting", value = "TestHello") | |
class TestNoDiscovery { | |
@Inject | |
private MyBean myBean; | |
@Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>io.helidon.microprofile.tests</groupId> | |
<artifactId>helidon-microprofile-tests-junit5</artifactId> | |
<scope>test</scope> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws Exception { | |
// Ein Handle für gRPC, das eine unäre Methode verwendet. Standardmäßig Java | |
// serialisieren, serialisieren und deserialisieren. | |
ClientServiceDescriptor descriptor = ClientServiceDescriptor | |
.builder(HelloService.class) | |
.unary("SayHello") | |
.build(); | |
// Erstelle einen Kanal am Port 1408 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws Exception { | |
// Implement the simplest possible gRPC service. | |
GrpcServer grpcServer = GrpcServer | |
.create(GrpcRouting.builder() | |
.register(new HelloService()) | |
.build()) | |
.start() | |
.toCompletableFuture() | |
.get(10, TimeUnit.SECONDS); | |
System.out.println("gRPC Server started at: http://localhost:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Single.just("1") | |
.map(Integer::parseInt) | |
.map(i -> i + 5) | |
.toStage() | |
.whenComplete((i, t) -> System.out.println("Result: " + i)); | |
> Result: 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AtomicInteger sum = new AtomicInteger(); | |
Multi.just("1", "2", "3", "4", "5") | |
.limit(3) | |
.map(Integer::parseInt) | |
.forEach(sum::addAndGet); | |
System.out.println("Sum: " + sum.get()); | |
> Sum: 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebClient client = WebClient.builder() | |
.baseUri("http://localhost") | |
.build(); | |
Single<String> response = client.get() | |
.path("/endpoint") | |
.request(String.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db: | |
source: "jdbc" | |
connection: | |
url: "jdbc:mysql://127.0.0.1:3306/pokemon?useSSL=false" | |
username: "user" | |
password: "password" | |
statements: | |
ping: "DO 0" | |
select-all-pokemons: "SELECT id, name FROM Pokemons" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbClient.execute(exec -> exec | |
.createUpdate("{\"collection\": \"pokemons\"," | |
+ "\"value\":{$set:{\"name\":$name}}," | |
+ "\"query\":{id:$id}}") | |
.addParam("id", 1) | |
.addParam("name", "Pikachu") | |
.execute() | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbClient.inTransaction(tx -> tx | |
.createQuery("SELECT name FROM Pokemons WHERE id = :id") | |
.addParam("id", 1) | |
.execute() | |
); |
NewerOlder