Class ReportPortal


  • public class ReportPortal
    extends java.lang.Object
    Default ReportPortal Reporter implementation. Uses Retrofit as REST WS Client
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ReportPortal.Builder  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ReportPortal.Builder builder()
      Creates new builder for ReportPortal
      static ReportPortal create​(ReportPortalClient client, ListenerParameters params)
      Creates new ReportPortal based on already built dependencies
      static ReportPortal create​(ReportPortalClient client, ListenerParameters params, java.util.concurrent.ExecutorService executor)
      Creates new ReportPortal based on already built dependencies
      static boolean emitLaunchLog​(ReportPortalMessage message, java.lang.String level, java.lang.Comparable<? extends java.lang.Comparable<?>> time)
      Emit log message to the current Launch.
      static boolean emitLaunchLog​(ReportPortalMessage message, java.lang.String level, java.util.Date time)
      Emit log message to the current Launch.
      static boolean emitLaunchLog​(java.lang.String message, java.lang.String level, java.lang.Comparable<? extends java.lang.Comparable<?>> time)
      Emits log message on Launch level if there is any active context attached to the current thread
      static boolean emitLaunchLog​(java.lang.String message, java.lang.String level, java.lang.Comparable<? extends java.lang.Comparable<?>> time, java.io.File file)
      Emits log message on Launch level if there is any active context attached to the current thread
      static boolean emitLaunchLog​(java.lang.String message, java.lang.String level, java.util.Date time)
      Emits log message on Launch level if there is any active context attached to the current thread
      static boolean emitLaunchLog​(java.lang.String message, java.lang.String level, java.util.Date time, java.io.File file)
      Emits log message on Launch level if there is any active context attached to the current thread
      static boolean emitLaunchLog​(java.util.function.Function<java.lang.String,​SaveLogRQ> logSupplier)
      Emits log message on Launch level if there is any active context attached to the current thread
      static boolean emitLog​(ReportPortalMessage message, java.lang.String level, java.lang.Comparable<? extends java.lang.Comparable<?>> time)
      Emit log message to the current test item.
      static boolean emitLog​(ReportPortalMessage message, java.lang.String level, java.util.Date time)
      Emit log message to the current test item.
      static boolean emitLog​(io.reactivex.Maybe<java.lang.String> itemUuid, java.util.function.Function<java.lang.String,​SaveLogRQ> logSupplier)
      Emits log message if there is any active context attached to the current thread
      static boolean emitLog​(java.lang.String message, java.lang.String level, java.lang.Comparable<? extends java.lang.Comparable<?>> time)
      Emits log message if there is any active context attached to the current thread
      static boolean emitLog​(java.lang.String message, java.lang.String level, java.lang.Comparable<? extends java.lang.Comparable<?>> time, java.io.File file)
      Emits log message if there is any active context attached to the current thread
      static boolean emitLog​(java.lang.String message, java.lang.String level, java.util.Date time)
      Emits log message if there is any active context attached to the current thread
      static boolean emitLog​(java.lang.String message, java.lang.String level, java.util.Date time, java.io.File file)
      Emits log message if there is any active context attached to the current thread
      static boolean emitLog​(java.util.function.Function<java.lang.String,​SaveLogRQ> logSupplier)
      Emits log message if there is any active context attached to the current thread
      ReportPortalClient getClient()  
      ListenerParameters getParameters()  
      Launch newLaunch​(StartLaunchRQ rq)
      Starts launch in ReportPortal
      static void sendStackTraceToRP​(java.lang.Throwable cause)
      Formats and reports a Throwable to ReportPortal
      static SaveLogRQ toSaveLogRQ​(java.lang.String launchUuid, java.lang.String itemUuid, java.lang.String level, java.lang.Comparable<? extends java.lang.Comparable<?>> time, ReportPortalMessage message)
      Launch withLaunch​(io.reactivex.Maybe<java.lang.String> launchUuid)
      Factory method for ReportPortal that uses already started launch
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • newLaunch

        @Nonnull
        public Launch newLaunch​(@Nonnull
                                StartLaunchRQ rq)
        Starts launch in ReportPortal
        Parameters:
        rq - Request Data
        Returns:
        Launch
      • withLaunch

        @Nonnull
        public Launch withLaunch​(@Nonnull
                                 io.reactivex.Maybe<java.lang.String> launchUuid)
        Factory method for ReportPortal that uses already started launch
        Parameters:
        launchUuid - Launch to be used
        Returns:
        This instance for chaining
      • getParameters

        @Nonnull
        public ListenerParameters getParameters()
        Returns:
        Configuration parameters
      • getClient

        @Nullable
        public ReportPortalClient getClient()
        Returns:
        ReportPortal client
      • create

        @Nonnull
        public static ReportPortal create​(@Nonnull
                                          ReportPortalClient client,
                                          @Nonnull
                                          ListenerParameters params,
                                          @Nonnull
                                          java.util.concurrent.ExecutorService executor)
        Creates new ReportPortal based on already built dependencies
        Parameters:
        client - ReportPortal Client
        params - ListenerParameters
        executor - An executor service which will be used for internal request / response queue
        Returns:
        builder for ReportPortal
      • emitLog

        public static boolean emitLog​(java.util.function.Function<java.lang.String,​SaveLogRQ> logSupplier)
        Emits log message if there is any active context attached to the current thread
        Parameters:
        logSupplier - Log supplier. Converts current Item ID to the SaveLogRQ object
        Returns:
        true if log has been emitted
      • emitLaunchLog

        public static boolean emitLaunchLog​(java.util.function.Function<java.lang.String,​SaveLogRQ> logSupplier)
        Emits log message on Launch level if there is any active context attached to the current thread
        Parameters:
        logSupplier - Log supplier. Converts current Item ID to the SaveLogRQ object
        Returns:
        true if log has been emitted
      • emitLog

        public static boolean emitLog​(io.reactivex.Maybe<java.lang.String> itemUuid,
                                      java.util.function.Function<java.lang.String,​SaveLogRQ> logSupplier)
        Emits log message if there is any active context attached to the current thread
        Parameters:
        itemUuid - Test Item ID promise
        logSupplier - Log supplier. Converts current Item ID to the SaveLogRQ object
        Returns:
        true if log has been emitted
      • emitLog

        public static boolean emitLog​(@Nullable
                                      java.lang.String message,
                                      @Nullable
                                      java.lang.String level,
                                      @Nonnull
                                      java.lang.Comparable<? extends java.lang.Comparable<?>> time)
        Emits log message if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        Returns:
        true if log has been emitted
      • emitLog

        public static boolean emitLog​(@Nullable
                                      java.lang.String message,
                                      @Nullable
                                      java.lang.String level,
                                      @Nonnull
                                      java.util.Date time)
        Emits log message if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        Returns:
        true if log has been emitted
      • emitLaunchLog

        public static boolean emitLaunchLog​(@Nullable
                                            java.lang.String message,
                                            @Nullable
                                            java.lang.String level,
                                            @Nonnull
                                            java.lang.Comparable<? extends java.lang.Comparable<?>> time)
        Emits log message on Launch level if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        Returns:
        true if log has been emitted
      • emitLaunchLog

        public static boolean emitLaunchLog​(@Nullable
                                            java.lang.String message,
                                            @Nullable
                                            java.lang.String level,
                                            @Nonnull
                                            java.util.Date time)
        Emits log message on Launch level if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        Returns:
        true if log has been emitted
      • toSaveLogRQ

        @Nonnull
        public static SaveLogRQ toSaveLogRQ​(@Nullable
                                            java.lang.String launchUuid,
                                            @Nullable
                                            java.lang.String itemUuid,
                                            @Nullable
                                            java.lang.String level,
                                            @Nonnull
                                            java.lang.Comparable<? extends java.lang.Comparable<?>> time,
                                            @Nonnull
                                            ReportPortalMessage message)
        Parameters:
        launchUuid - a UUID of the launch
        itemUuid - a UUID of the test item
        level - message level
        time - timestamp of the message
        message - an object to convert
        Returns:
        converted object
      • emitLog

        public static boolean emitLog​(@Nullable
                                      java.lang.String message,
                                      @Nullable
                                      java.lang.String level,
                                      @Nonnull
                                      java.lang.Comparable<? extends java.lang.Comparable<?>> time,
                                      java.io.File file)
        Emits log message if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        file - a file to attach to the log message
        Returns:
        true if log has been emitted
      • emitLog

        public static boolean emitLog​(@Nullable
                                      java.lang.String message,
                                      @Nullable
                                      java.lang.String level,
                                      @Nonnull
                                      java.util.Date time,
                                      java.io.File file)
        Emits log message if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        file - a file to attach to the log message
        Returns:
        true if log has been emitted
      • emitLaunchLog

        public static boolean emitLaunchLog​(@Nullable
                                            java.lang.String message,
                                            @Nullable
                                            java.lang.String level,
                                            @Nonnull
                                            java.lang.Comparable<? extends java.lang.Comparable<?>> time,
                                            java.io.File file)
        Emits log message on Launch level if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        file - a file to attach to the log message
        Returns:
        true if log has been emitted
      • emitLaunchLog

        public static boolean emitLaunchLog​(@Nullable
                                            java.lang.String message,
                                            @Nullable
                                            java.lang.String level,
                                            @Nonnull
                                            java.util.Date time,
                                            java.io.File file)
        Emits log message on Launch level if there is any active context attached to the current thread
        Parameters:
        message - Log message
        level - Log level
        time - Log time
        file - a file to attach to the log message
        Returns:
        true if log has been emitted
      • emitLog

        public static boolean emitLog​(ReportPortalMessage message,
                                      @Nullable
                                      java.lang.String level,
                                      @Nonnull
                                      java.lang.Comparable<? extends java.lang.Comparable<?>> time)
        Emit log message to the current test item.
        Parameters:
        message - an instance of the message
        level - message level
        time - timestamp of the message
        Returns:
        true if log has been emitted otherwise false
      • emitLog

        public static boolean emitLog​(ReportPortalMessage message,
                                      @Nullable
                                      java.lang.String level,
                                      @Nonnull
                                      java.util.Date time)
        Emit log message to the current test item.
        Parameters:
        message - an instance of the message
        level - message level
        time - timestamp of the message
        Returns:
        true if log has been emitted otherwise false
      • emitLaunchLog

        public static boolean emitLaunchLog​(ReportPortalMessage message,
                                            @Nullable
                                            java.lang.String level,
                                            @Nonnull
                                            java.lang.Comparable<? extends java.lang.Comparable<?>> time)
        Emit log message to the current Launch.
        Parameters:
        message - an instance of the message
        level - message level
        time - timestamp of the message
        Returns:
        true if log has been emitted otherwise false
      • emitLaunchLog

        public static boolean emitLaunchLog​(ReportPortalMessage message,
                                            @Nullable
                                            java.lang.String level,
                                            @Nonnull
                                            java.util.Date time)
        Emit log message to the current Launch.
        Parameters:
        message - an instance of the message
        level - message level
        time - timestamp of the message
        Returns:
        true if log has been emitted otherwise false
      • sendStackTraceToRP

        public static void sendStackTraceToRP​(java.lang.Throwable cause)
        Formats and reports a Throwable to ReportPortal
        Parameters:
        cause - a Throwable