package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util;
import com.google.common.io.ByteStreams;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-
import java.io.InputStream;
import java.io.PrintStream;
+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.
Thread.sleep(millis);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- throw new RuntimeException(e);
+ throw new UserInvisibleError("Interrupted while sleeping", e);
}
}
* 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).
InputStream stream = SystemFunctions.class.getClassLoader().getResourceAsStream(url);
return ByteStreams.toByteArray(stream);
} catch (Exception e) {
- throw new RuntimeException("Unable to load " + url, e);
+ throw new UserVisibleError("Unable to load " + url, e);
}
}
* variable <code>out</code>, has been redirected to a file or other
* destination that is typically not continuously monitored.
*/
+ @SuppressWarnings("squid:S106") // (intentional wrapping of system err)
public PrintStream err() {
- return System.err; //NO SONAR (intentional wrapping of system err
+ return System.err;
}
/**
* @see java.io.PrintStream#println(java.lang.Object)
* @see java.io.PrintStream#println(java.lang.String)
*/
+ @SuppressWarnings("squid:S106") // (intentional wrapping of system err)
public PrintStream out() {
- return System.out; //NO SONAR (intentional wrapping of system out)
+ return System.out;
}
/**
public CloseableHttpClient getHttpClient() {
return HttpClients.createDefault();
}
-}
+
+ /**
+ * @param clazz the main source of the Spring application
+ * @return a new Spring application
+ */
+ public SpringApplication newSpringApplication(Class clazz) {
+ return new SpringApplication(clazz);
+ }
+}
\ No newline at end of file