File tree Expand file tree Collapse file tree
examples/hello-java/src/main/java/org/cloudfoundry/demo Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : E2E Tests on KinD
22
33on :
4+ pull_request :
5+ branches : ["main"]
46 push :
5- branches :
6- - main
7+ branches : ["main"]
78 workflow_dispatch :
89
910jobs :
5960 default/$(kubectl get pod -n default -l app.kubernetes.io/name=fileserver \
6061 -o jsonpath='{.items[0].metadata.name}'):fileserver/v1/static/cnb_app_lifecycle/cnb_app_lifecycle.tgz
6162 - name : Run E2E tests for java
62- run : cf push hello-java -f examples/hello-java/manifest.yaml
63+ run : |
64+ cf push hello-java -f examples/hello-java/manifest.yaml
65+ curl -s -f hello-java.apps.127-0-0-1.nip.io | grep -F "Hello World"
66+ cf delete hello-java -f -r
6367 - name : Run E2E tests for nodejs
64- run : cf push hello-js -f examples/hello-js/manifest.yaml
65-
68+ run : |
69+ cf push hello-js -f examples/hello-js/manifest.yaml
70+ curl -s -f hello-js.apps.127-0-0-1.nip.io | grep -F "Hello World"
71+ cf delete hello-js -f -r
72+
Original file line number Diff line number Diff line change 55import org .springframework .web .bind .annotation .GetMapping ;
66import org .springframework .web .bind .annotation .RestController ;
77
8- import java .util .ArrayList ;
9- import java .util .List ;
10-
118@ SpringBootApplication (proxyBeanMethods =false )
129@ RestController
1310public class Application {
@@ -16,19 +13,20 @@ public static void main(String[] args) {
1613 SpringApplication .run (Application .class , args );
1714 }
1815
16+ // CPU-intensive Fibonacci calculation
17+ private long fib (int n ) {
18+ if (n <= 1 ) return n ;
19+ return fib (n - 1 ) + fib (n - 2 );
20+ }
21+
1922 @ GetMapping ("/" )
20- public String fibonacci () {
21- List <Long > fibNumbers = new ArrayList <>();
22- long a = 0 , b = 1 ;
23+ public String index () {
24+ String instanceIndex = System .getenv ("CF_INSTANCE_INDEX" );
2325
24- for (int i = 0 ; i < 40 ; i ++) {
25- fibNumbers .add (a );
26- long next = a + b ;
27- a = b ;
28- b = next ;
29- }
26+ // Do CPU-intensive work
27+ long fibResult = fib (40 );
28+ System .out .println ("Computed Fibonacci(40): " + fibResult );
3029
31- return fibNumbers . toString () ;
30+ return "Hello World! (CF_INSTANCE_INDEX: " + instanceIndex + ") \n Fibonacci(40): " + fibResult + " \n " ;
3231 }
33-
3432}
You can’t perform that action at this time.
0 commit comments