forked from micronaut-projects/micronaut-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
543 changed files
with
16,759 additions
and
2,903 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
84 changes: 84 additions & 0 deletions
84
...-client/src/test/groovy/io/micronaut/function/client/aws/LocalFunctionInvokeJavaSpec.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package io.micronaut.function.client.aws; | ||
|
||
//tag::import[] | ||
import io.micronaut.context.ApplicationContext; | ||
import io.micronaut.function.client.FunctionClient; | ||
import javax.inject.Named; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
//end::rxImport[] | ||
//end::import[] | ||
|
||
import io.micronaut.runtime.server.EmbeddedServer; | ||
//tag::rxImport[] | ||
import io.reactivex.Single; | ||
|
||
public class LocalFunctionInvokeJavaSpec { | ||
|
||
//tag::invokeLocalFunction[] | ||
@Test | ||
public void testInvokingALocalFunction() { | ||
Sum sum = new Sum(); | ||
sum.setA(5); | ||
sum.setB(10); | ||
|
||
EmbeddedServer server = ApplicationContext.run(EmbeddedServer.class); | ||
MathClient mathClient = server.getApplicationContext().getBean(MathClient.class); | ||
|
||
assertEquals(Long.valueOf(Integer.MAX_VALUE), mathClient.max()); | ||
assertEquals(2, mathClient.rnd(1.6f)); | ||
assertEquals(15, mathClient.sum(sum)); | ||
|
||
} | ||
//end::invokeLocalFunction[] | ||
|
||
//tag::invokeRxLocalFunction[] | ||
@Test | ||
public void testInvokingALocalFunctionRX() { | ||
Sum sum = new Sum(); | ||
sum.setA(5); | ||
sum.setB(10); | ||
|
||
EmbeddedServer server = ApplicationContext.run(EmbeddedServer.class); | ||
RxMathClient mathClient = server.getApplicationContext().getBean(RxMathClient.class); | ||
|
||
assertEquals(Long.valueOf(Integer.MAX_VALUE), mathClient.max().blockingGet()); | ||
assertEquals(2, mathClient.rnd(1.6f).blockingGet().longValue()); | ||
assertEquals(15, mathClient.sum(sum).blockingGet().longValue()); | ||
|
||
} | ||
//end::invokeRxLocalFunction[] | ||
|
||
//tag::beginFunctionClient[] | ||
@FunctionClient | ||
interface MathClient { | ||
//end::beginFunctionClient[] | ||
|
||
//tag::functionMax[] | ||
Long max(); //<1> | ||
//end::functionMax[] | ||
|
||
//tag::functionRnd[] | ||
@Named("round") | ||
int rnd(float value); | ||
//end::functionRnd[] | ||
|
||
long sum(Sum sum); | ||
//tag::endFunctionClient[] | ||
} | ||
//end::endFunctionClient[] | ||
|
||
|
||
//tag::rxFunctionClient[] | ||
@FunctionClient | ||
interface RxMathClient { | ||
Single<Long> max(); | ||
|
||
@Named("round") | ||
Single<Integer> rnd(float value); | ||
|
||
Single<Long> sum(Sum sum); | ||
} | ||
//end::rxFunctionClient[] | ||
} |
Oops, something went wrong.