@@ -541,5 +541,51 @@ public void onError(Ack ack) {
541541
542542 }
543543
544+ @ Test
545+ public void getRuntimeInfo () throws Exception {
546+ CountDownLatch latch = new CountDownLatch (1 );
547+ runtime .getRuntimeInfo (new AckListener () {
548+ @ Override
549+ public void onSuccess (Ack ack ) {
550+ if (ack .isSuccessful ()) {
551+ // { "manifestUrl":"http://localhost:5090/getManifest","port":9696,"version":"8.56.30.37","architecture":"x64"}
552+ JSONObject data = (JSONObject ) ack .getData ();
553+ if (data .has ("manifestUrl" ) && data .has ("port" ) && data .has ("version" )) {
554+ latch .countDown ();
555+ }
556+ }
557+ }
558+
559+ @ Override
560+ public void onError (Ack ack ) {
561+ }
562+ });
563+ latch .await (5 , TimeUnit .SECONDS );
564+ assertEquals ("getRuntimeInfo timeout" , latch .getCount (), 0 );
565+ }
566+
567+ @ Test
568+ public void getRvmInfo () throws Exception {
569+ CountDownLatch latch = new CountDownLatch (1 );
570+ runtime .getRvmInfo (new AckListener () {
571+ @ Override
572+ public void onSuccess (Ack ack ) {
573+ if (ack .isSuccessful ()) {
574+ // { "action":"get-rvm-info","path":"C:\\Users\\abc\\AppData\\Local\\OpenFin\\OpenFinRVM.exe","start-time":"2018-04-12 14:01:41","version":"4.0.1.1","working-dir":"C:\\Users\\abc\\AppData\\Local\\OpenFin"}
575+ JSONObject data = (JSONObject ) ack .getData ();
576+ if (data .has ("action" ) && data .has ("path" ) && data .has ("start-time" )) {
577+ latch .countDown ();
578+ }
579+ }
580+ }
581+
582+ @ Override
583+ public void onError (Ack ack ) {
584+ }
585+ });
586+ latch .await (5 , TimeUnit .SECONDS );
587+ assertEquals ("getRvmInfo timeout" , latch .getCount (), 0 );
588+ }
589+
544590
545591}
0 commit comments