psdi.app.dpldasset.unittest

Class UnitTestUtil

  • java.lang.Object
    • psdi.app.dpldasset.unittest.UnitTestUtil


  • public abstract class UnitTestUtil
    extends java.lang.Object
    Attaches an instance of MaximoPrimaryKeyFilter to the database connection it is listening to.
    Since:
    7.2.1
    • Constructor Summary

      Constructors 
      Constructor and Description
      UnitTestUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      static MboRemote[] createMbo(MboRemote parent, java.lang.String objectName, java.util.Map[] attributesBatch, UserInfo userInfo) 
      static MboRemote[] createMbo(MboRemote parent, java.lang.String objectName, java.util.Map attributes, UserInfo userInfo) 
      static void deleteRecords(java.lang.String objectName, java.lang.String whereClause, UserInfo userInfo) 
      static java.lang.String getMaximoPresentation(java.lang.String presentationName, java.lang.String userName)
      Retrieves a Maximo presentation from the Maximo database
      static java.lang.String getMaximoPresentation(java.lang.String presentationName, UserInfo userInfo)
      Retrieves a Maximo presentation from the Maximo database
      static MboSetRemote getMboSet(java.lang.String mboSetName, java.lang.String whereClause, UserInfo userInfo)
      TODO Fill-in method description and parameters.
      static MboSetRemote getMboSet(java.lang.String mboSetName, UserInfo userInfo)
      TODO Fill-in method description and parameters.
      static java.lang.Object getPrivateField(java.lang.Object classInstance, java.lang.String fieldName)
      Obtains a field from a class instance.
      static UserInfo getUserInfo(java.lang.String userName)
      Internal use only
      static UserInfo getUserInfo(java.lang.String userName, java.lang.String password)
      Deprecated. 
      Use getUserInfo(final String userName) instead
      static java.lang.Object invokeMethod(java.lang.Object classInstance, java.lang.String methodName, java.lang.Object[] params)
      Invokes a method on an object instance.
      protected static void loadProperties()
      TODO Fill-in method description and parameters.
      static void setObjectAttributes(java.util.Map attributes, MboRemote mbo) 
      • Methods inherited from class java.lang.Object

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

      • UnitTestUtil

        public UnitTestUtil()
    • Method Detail

      • loadProperties

        protected static void loadProperties()
                                      throws java.io.FileNotFoundException,
                                             MXSystemException
        TODO Fill-in method description and parameters.

        Only single-threaded access is expected but serialize access nevertheless, just in case. Will do no harm

        Parameters:
        -
        Throws:
        java.io.FileNotFoundException
        MXSystemException
      • getPrivateField

        public static java.lang.Object getPrivateField(java.lang.Object classInstance,
                                                       java.lang.String fieldName)
                                                throws java.lang.Exception
        Obtains a field from a class instance. Alters the access privilege to allow access to private and protected fields

        To be used exclusively within JUnit test cases

        Parameters:
        classInstance - The instance from which to get the field value
        fieldName - The name of the requested field
        Returns:
        The value of the field. If it is a primitive, then a class wrapper is created automatically
        Throws:
        java.lang.Exception
      • invokeMethod

        public static java.lang.Object invokeMethod(java.lang.Object classInstance,
                                                    java.lang.String methodName,
                                                    java.lang.Object[] params)
                                             throws java.lang.Throwable
        Invokes a method on an object instance. Alters the access privilege to allow the invocation of private and protected methods

        To be used exclusively within JUnit test cases

        Parameters:
        classInstance - The instance on which to call the method
        methodName - The name of the method to invoke
        params - The paremeters for the method. Can be null for a method that takes no parameters. Integral types need to be wrapped in a class instance. The caller should construct them using this pseudocode:

        final Object params[] = { param1_instance, param2_instance, ... };

        Returns:
        The return value from the invoked method. Can be null. If return value is a primitive, then a class wrapper is created automatically
        Throws:
        java.lang.Throwable - Passes along any exception that the invoked method could throw
      • getMaximoPresentation

        public static java.lang.String getMaximoPresentation(java.lang.String presentationName,
                                                             java.lang.String userName)
                                                      throws java.lang.Exception
        Retrieves a Maximo presentation from the Maximo database

        To be used exclusively within DBUnit test cases

        Parameters:
        presentationName - The name of the presentation to be loaded
        userName - The user name - will be authenticated without password information
        Returns:
        The presentation XML retrieved from the database
        Throws:
        java.lang.Throwable - Passes along any exception that the invoked method could throw
        java.lang.Exception
      • getMaximoPresentation

        public static java.lang.String getMaximoPresentation(java.lang.String presentationName,
                                                             UserInfo userInfo)
                                                      throws java.lang.Exception
        Retrieves a Maximo presentation from the Maximo database

        To be used exclusively within DBUnit test cases

        Parameters:
        presentationName - The name of the presentation to be loaded
        userInfo - The authenticated user info structure
        Returns:
        The presentation XML retrieved from the database
        Throws:
        java.lang.Throwable - Passes along any exception that the invoked method could throw
        java.lang.Exception
      • getUserInfo

        public static UserInfo getUserInfo(java.lang.String userName,
                                           java.lang.String password)
                                    throws java.lang.Exception
        Deprecated. Use getUserInfo(final String userName) instead
        Internal use only

        Get the authenticated user info

        Throws:
        java.lang.Exception
      • getUserInfo

        public static UserInfo getUserInfo(java.lang.String userName)
                                    throws java.lang.Exception
        Internal use only

        Get the authenticated user info

        Throws:
        java.lang.Exception
      • getMboSet

        public static MboSetRemote getMboSet(java.lang.String mboSetName,
                                             UserInfo userInfo)
                                      throws java.lang.Exception
        TODO Fill-in method description and parameters.
        Parameters:
        -
        Returns:
        Throws:
        java.lang.Exception
      • getMboSet

        public static MboSetRemote getMboSet(java.lang.String mboSetName,
                                             java.lang.String whereClause,
                                             UserInfo userInfo)
                                      throws java.lang.Exception
        TODO Fill-in method description and parameters.
        Parameters:
        -
        Returns:
        Throws:
        java.lang.Exception
      • deleteRecords

        public static void deleteRecords(java.lang.String objectName,
                                         java.lang.String whereClause,
                                         UserInfo userInfo)
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createMbo

        public static MboRemote[] createMbo(MboRemote parent,
                                            java.lang.String objectName,
                                            java.util.Map attributes,
                                            UserInfo userInfo)
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createMbo

        public static MboRemote[] createMbo(MboRemote parent,
                                            java.lang.String objectName,
                                            java.util.Map[] attributesBatch,
                                            UserInfo userInfo)
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setObjectAttributes

        public static void setObjectAttributes(java.util.Map attributes,
                                               MboRemote mbo)
                                        throws MXException,
                                               java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException