Fix concureny issues in test code
[vfc/nfvo/driver/vnfm/svnfm.git] / nokiav2 / driver / src / main / java / org / onap / vfc / nfvo / driver / vnfm / svnfm / nokia / util / SystemFunctions.java
index c7fac86..51d76ac 100644 (file)
 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util;
 
 import com.google.common.io.ByteStreams;
-import io.reactivex.Observable;
 import java.io.InputStream;
 import java.io.PrintStream;
-import java.util.NoSuchElementException;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
+import org.springframework.boot.SpringApplication;
 
 /**
  * Wrapper class for static method calls to core or core libraries.
@@ -58,7 +57,7 @@ public class SystemFunctions {
             Thread.sleep(millis);
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
-            throw new UserInvisibleError("Interrupted while sleep", e);
+            throw new UserInvisibleError("Interrupted while sleeping", e);
         }
     }
 
@@ -69,7 +68,7 @@ public class SystemFunctions {
      * operating system and may be larger.  For example, many
      * operating systems measure time in units of tens of
      * milliseconds.
-     * <p>
+     *
      * <p> See the description of the class <code>Date</code> for
      * a discussion of slight discrepancies that may arise between
      * Unable to load /unittests/missing     * "computer time" and coordinated universal time (UTC).
@@ -164,16 +163,10 @@ public class SystemFunctions {
     }
 
     /**
-     * Execute blocking first
-     *
-     * @param observable the observable
+     * @param clazz the main source of the Spring application
+     * @return a new Spring application
      */
-    public void blockingFirst(Observable<Void> observable) {
-        try {
-            observable.blockingFirst();
-        } catch (NoSuchElementException e) {
-            //swallow void returns null :)
-        }
+    public SpringApplication newSpringApplication(Class clazz) {
+        return new SpringApplication(clazz);
     }
-
 }
\ No newline at end of file