psdi.unittest

Class AssertionsUtil

  • java.lang.Object
    • psdi.unittest.AssertionsUtil


  • public class AssertionsUtil
    extends java.lang.Object
    Provides a library of common assertions.
    • Constructor Summary

      Constructors 
      Constructor and Description
      AssertionsUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void assertDuplicate(MboRemote mboOrig, MboRemote mboCopy, java.lang.String[] skipCols)
      Asserts Mbo mboOrig have been duplicated properly.
      static void assertFault(java.lang.Throwable e, java.lang.String faultType, java.lang.String group, java.lang.String key, boolean okIfAssignable)
      Asserts the fault e is of the type faultType.
      static void assertFault(java.lang.Throwable e, java.lang.String faultType, java.lang.String group, java.lang.String key, java.lang.String bmxid, boolean okIfAssignable)
      Asserts the fault e is of the type faultType.
      static void assertFault(java.lang.Throwable e, java.lang.String faultType, java.lang.String group, java.lang.String key, java.lang.String bmxid, boolean okIfAssignable, boolean maxmsgCheck)
      Asserts the fault e is of the type faultType.
      static MboRemote assertLoadTestData(java.lang.String testdataId)
      Asserts the test data testdataId resolves to a Mbo.
      static MboRemote assertLoadTestData(java.lang.String testdataId, UserInfo userInfo)
      Asserts the test data testdataId resolves to a Mbo.
      static void assertMaxVarHasValue(java.lang.String orgSite, java.lang.String varName, boolean value) 
      static void assertMaxVarHasValue(java.lang.String orgSite, java.lang.String varName, java.lang.String value) 
      static void assertMaxVarIsFalse(java.lang.String orgSite, java.lang.String varName) 
      static void assertMaxVarIsTrue(java.lang.String orgSite, java.lang.String varName) 
      static void assertMboAttrEquals(MboRemote mbo, java.lang.String attributeName, java.lang.Object expected)
      Asserts a Mbo mbo attribute attributeName value equals expected value.
      static void assertMboAttrEqualsMboAttr(MboRemote mbo, java.lang.String attributeName, MboRemote toMbo, java.lang.String compareToAttrName)
      Asserts a Mbo mbo attribute attributeName value equals another Mbo toMbo attribute compareToAttrName value.
      static void assertMboAttrEqualsMboAttr(MboRemote mbo, java.lang.String attributeName, java.lang.String compareToAttrName)
      Asserts a Mbo mbo attribute attributeName value equals another attribute compareToAttrName value.
      static void assertMboAttrHidden(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName is hidden
      static void assertMboAttrNotEquals(MboRemote mbo, java.lang.String attributeName, java.lang.Object unexpected)
      Asserts a Mbo mbo attribute attributeName value is NOT equals to the unexpected value.
      static void assertMboAttrNotHidden(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName is not hidden
      static void assertMboAttrNotNull(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName is not null
      static void assertMboAttrNotReadonly(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName is not readonly
      static void assertMboAttrNotRequired(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName is not required
      static void assertMboAttrNull(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName value is null
      static void assertMboAttrReadonly(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName is readonly
      static void assertMboAttrRequired(MboRemote mbo, java.lang.String attributeName)
      Asserts a Mbo mbo attribute attributeName is required
      static void assertMboHidden(MboRemote mbo)
      Asserts Mbo mbo has the selected flag set.
      static void assertMboNotExists(java.lang.String mboName, long id)
      Asserts Mbo mbo is a zombie.
      static void assertMboNotSelected(MboRemote mbo)
      Asserts selected flag is not set for the Mbo
      static void assertMboNotZombie(MboRemote mbo)
      Asserts Mbo mbo is not a zombie.
      static void assertMboReadonly(MboRemote mbo)
      Asserts Mbo mbo has the selected flag set.
      static void assertMboSelected(MboRemote mbo)
      Asserts Mbo mbo has the selected flag set.
      static void assertMboSetCountEquals(MboRemote mbo, java.lang.String relation, int expectedCount)
      Asserts Mbo mbo related MboSet has count equal to expectedCount
      static void assertMboSetCountEquals(MboRemote mbo, java.lang.String relation, int expectedCount, int countFlag)
      Asserts Mbo mbo related MboSet has count for count flag countFlag equal to expectedCount
      static void assertMboSetCountEquals(MboRemote mbo, java.lang.String objectName, java.lang.String where, int expectedCount, int countFlag, UserInfo userInfo)
      Asserts Mbo mbo related MboSet has count for count flag countFlag equal to expectedCount
      static void assertMboSetCountEquals(MboRemote mbo, java.lang.String objectName, java.lang.String where, int expectedCount, UserInfo userInfo)
      Asserts Mbo mbo related MboSet has count for count flag countFlag equal to expectedCount
      static void assertMboSetCountEquals(MboSetRemote mboSet, int expectedCount)
      Asserts MboSet mboSet has count equal to expectedCount for flag countFlag
      static void assertMboSetDiscardable(MboSetRemote mboSet)
      Asserts MboSet mboSet is discardable.
      static void assertMboSetFlagSet(MboSetRemote mboSet, long flag, java.lang.String flagText)
      Asserts flag flag is set for the MboSet mboSet
      static void assertMboSetNoAdd(MboSetRemote mboSet)
      Asserts Mbos cannot be added to the MboSet mboSet.
      static void assertMboSetNoDelete(MboSetRemote mboSet)
      Asserts Mbos cannot be deleted from MboSet mboSet.
      static void assertMboSetNoSave(MboSetRemote mboSet)
      Asserts MboSet mboSet cannot be saved.
      static void assertMboSetNotDiscardable(MboSetRemote mboSet)
      Asserts MboSet mboSet is not discardable.
      static void assertMboSetNotReadonly(MboSetRemote mboSet)
      Asserts MboSet mboSet is not readonly.
      static void assertMboSetReadonly(MboSetRemote mboSet)
      Asserts MboSet mboSet is readonly.
      static void assertMboZombie(MboRemote mbo)
      Asserts Mbo mbo is a zombie.
      static void assertOSSchemaValidate(byte[] xml, java.lang.String osName)
      Asserts if the os xml [request/response] conforms to the os service schema
      static MboRemote assertReloadTestData(java.lang.String testdataId)
      Asserts the test data testdataId resolves to a certain newly fetched Mbo.
      static void assertWarning(MboRemote mbo, java.lang.String warningType, java.lang.String group, java.lang.String key) 
      static void assertWarning(MboRemote mbo, java.lang.String warningType, java.lang.String group, java.lang.String key, boolean okIfAssignable)
      Asserts the warning of the type warningType is set in the Mbo.
      static void assertWarning(MboSetRemote mboSet, java.lang.String warningType, java.lang.String group, java.lang.String key) 
      static void assertWarning(MboSetRemote mboSet, java.lang.String warningType, java.lang.String group, java.lang.String key, boolean okIfAssignable) 
      static java.lang.String getMboUniqueIdString(MboRemote mbo) 
      static boolean isNull(java.lang.String value) 
      • Methods inherited from class java.lang.Object

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

      • AssertionsUtil

        public AssertionsUtil()
    • Method Detail

      • assertOSSchemaValidate

        public static void assertOSSchemaValidate(byte[] xml,
                                                  java.lang.String osName)
        Asserts if the os xml [request/response] conforms to the os service schema
        Parameters:
        xml - the os request/response xml
        osName - the name of the object structure
      • assertDuplicate

        public static void assertDuplicate(MboRemote mboOrig,
                                           MboRemote mboCopy,
                                           java.lang.String[] skipCols)
        Asserts Mbo mboOrig have been duplicated properly.
        Parameters:
        mboOrig - the original Mbo
        mboCopy - the duplicate Mbo
        skipCols - the columns to skip for comparing. This is in addition to the columns that are marked in the Mbo mboOrig to be not duplicated.
      • assertReloadTestData

        public static MboRemote assertReloadTestData(java.lang.String testdataId)
        Asserts the test data testdataId resolves to a certain newly fetched Mbo.
        Parameters:
        testdataId - the test data id
        Returns:
      • assertLoadTestData

        public static MboRemote assertLoadTestData(java.lang.String testdataId)
        Asserts the test data testdataId resolves to a Mbo.
        Parameters:
        testdataId - the test data id
        Returns:
      • assertLoadTestData

        public static MboRemote assertLoadTestData(java.lang.String testdataId,
                                                   UserInfo userInfo)
        Asserts the test data testdataId resolves to a Mbo.
        Parameters:
        testdataId - the test data id
        Returns:
      • assertMboSelected

        public static void assertMboSelected(MboRemote mbo)
        Asserts Mbo mbo has the selected flag set.
        Parameters:
        mbo -
      • assertMboHidden

        public static void assertMboHidden(MboRemote mbo)
        Asserts Mbo mbo has the selected flag set.
        Parameters:
        mbo -
      • assertMboReadonly

        public static void assertMboReadonly(MboRemote mbo)
        Asserts Mbo mbo has the selected flag set.
        Parameters:
        mbo -
      • getMboUniqueIdString

        public static java.lang.String getMboUniqueIdString(MboRemote mbo)
                                                     throws java.rmi.RemoteException,
                                                            MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • assertMboNotSelected

        public static void assertMboNotSelected(MboRemote mbo)
        Asserts selected flag is not set for the Mbo
        Parameters:
        mbo -
      • assertMboNotExists

        public static void assertMboNotExists(java.lang.String mboName,
                                              long id)
        Asserts Mbo mbo is a zombie.
        Parameters:
        mbo -
      • assertMboZombie

        public static void assertMboZombie(MboRemote mbo)
        Asserts Mbo mbo is a zombie.
        Parameters:
        mbo -
      • assertMboNotZombie

        public static void assertMboNotZombie(MboRemote mbo)
        Asserts Mbo mbo is not a zombie.
        Parameters:
        mbo -
      • assertMboSetReadonly

        public static void assertMboSetReadonly(MboSetRemote mboSet)
        Asserts MboSet mboSet is readonly.
        Parameters:
        mboSet -
      • assertMboSetNotReadonly

        public static void assertMboSetNotReadonly(MboSetRemote mboSet)
        Asserts MboSet mboSet is not readonly.
        Parameters:
        mboSet -
      • assertMboSetDiscardable

        public static void assertMboSetDiscardable(MboSetRemote mboSet)
        Asserts MboSet mboSet is discardable.
        Parameters:
        mboSet -
      • assertMboSetNotDiscardable

        public static void assertMboSetNotDiscardable(MboSetRemote mboSet)
        Asserts MboSet mboSet is not discardable.
        Parameters:
        mboSet -
      • assertMboSetNoSave

        public static void assertMboSetNoSave(MboSetRemote mboSet)
        Asserts MboSet mboSet cannot be saved.
        Parameters:
        mboSet -
      • assertMboSetNoDelete

        public static void assertMboSetNoDelete(MboSetRemote mboSet)
        Asserts Mbos cannot be deleted from MboSet mboSet.
        Parameters:
        mboSet -
      • assertMboSetNoAdd

        public static void assertMboSetNoAdd(MboSetRemote mboSet)
        Asserts Mbos cannot be added to the MboSet mboSet.
        Parameters:
        mboSet -
      • assertMboSetFlagSet

        public static void assertMboSetFlagSet(MboSetRemote mboSet,
                                               long flag,
                                               java.lang.String flagText)
        Asserts flag flag is set for the MboSet mboSet
        Parameters:
        mboSet - MboSet for assertion test
        flag - the flag to assert on
        flagText - the
      • assertMboAttrEqualsMboAttr

        public static void assertMboAttrEqualsMboAttr(MboRemote mbo,
                                                      java.lang.String attributeName,
                                                      MboRemote toMbo,
                                                      java.lang.String compareToAttrName)
        Asserts a Mbo mbo attribute attributeName value equals another Mbo toMbo attribute compareToAttrName value.
        Parameters:
        mbo -
        attributeName -
        toMbo -
        compareToAttrName -
      • assertMboAttrEqualsMboAttr

        public static void assertMboAttrEqualsMboAttr(MboRemote mbo,
                                                      java.lang.String attributeName,
                                                      java.lang.String compareToAttrName)
        Asserts a Mbo mbo attribute attributeName value equals another attribute compareToAttrName value.
        Parameters:
        mbo -
        attributeName -
        compareToAttrName -
      • assertMboAttrEquals

        public static void assertMboAttrEquals(MboRemote mbo,
                                               java.lang.String attributeName,
                                               java.lang.Object expected)
        Asserts a Mbo mbo attribute attributeName value equals expected value.
        Parameters:
        mbo -
        attributeName -
        expected -
      • assertMboAttrNotEquals

        public static void assertMboAttrNotEquals(MboRemote mbo,
                                                  java.lang.String attributeName,
                                                  java.lang.Object unexpected)
        Asserts a Mbo mbo attribute attributeName value is NOT equals to the unexpected value.
      • assertMboAttrNull

        public static void assertMboAttrNull(MboRemote mbo,
                                             java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName value is null
        Parameters:
        mbo -
        attributeName -
      • assertMboAttrReadonly

        public static void assertMboAttrReadonly(MboRemote mbo,
                                                 java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName is readonly
        Parameters:
        mbo -
        attributeName -
      • assertMboAttrHidden

        public static void assertMboAttrHidden(MboRemote mbo,
                                               java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName is hidden
        Parameters:
        mbo -
        attributeName -
      • assertMboAttrRequired

        public static void assertMboAttrRequired(MboRemote mbo,
                                                 java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName is required
        Parameters:
        mbo -
        attributeName -
      • assertMboAttrNotNull

        public static void assertMboAttrNotNull(MboRemote mbo,
                                                java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName is not null
        Parameters:
        mbo -
        attributeName -
      • assertMboAttrNotReadonly

        public static void assertMboAttrNotReadonly(MboRemote mbo,
                                                    java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName is not readonly
        Parameters:
        mbo -
        attributeName -
      • assertMboAttrNotHidden

        public static void assertMboAttrNotHidden(MboRemote mbo,
                                                  java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName is not hidden
        Parameters:
        mbo -
        attributeName -
      • assertMboAttrNotRequired

        public static void assertMboAttrNotRequired(MboRemote mbo,
                                                    java.lang.String attributeName)
        Asserts a Mbo mbo attribute attributeName is not required
        Parameters:
        mbo -
        attributeName -
      • assertMboSetCountEquals

        public static void assertMboSetCountEquals(MboRemote mbo,
                                                   java.lang.String relation,
                                                   int expectedCount)
        Asserts Mbo mbo related MboSet has count equal to expectedCount
        Parameters:
        mbo -
        relation - relationship name
        expectedCount -
      • assertMboSetCountEquals

        public static void assertMboSetCountEquals(MboSetRemote mboSet,
                                                   int expectedCount)
        Asserts MboSet mboSet has count equal to expectedCount for flag countFlag
        Parameters:
        mboSet - MboSet instance to test
        expectedCount - the expected count
      • assertMboSetCountEquals

        public static void assertMboSetCountEquals(MboRemote mbo,
                                                   java.lang.String relation,
                                                   int expectedCount,
                                                   int countFlag)
        Asserts Mbo mbo related MboSet has count for count flag countFlag equal to expectedCount
        Parameters:
        mbo -
        relation - relationship name
        expectedCount -
        countFlag - count flag
      • assertMboSetCountEquals

        public static void assertMboSetCountEquals(MboRemote mbo,
                                                   java.lang.String objectName,
                                                   java.lang.String where,
                                                   int expectedCount,
                                                   UserInfo userInfo)
        Asserts Mbo mbo related MboSet has count for count flag countFlag equal to expectedCount
        Parameters:
        mbo -
        objectName -
        where -
        expectedCount -
        userInfo -
      • assertMboSetCountEquals

        public static void assertMboSetCountEquals(MboRemote mbo,
                                                   java.lang.String objectName,
                                                   java.lang.String where,
                                                   int expectedCount,
                                                   int countFlag,
                                                   UserInfo userInfo)
        Asserts Mbo mbo related MboSet has count for count flag countFlag equal to expectedCount
        Parameters:
        mbo -
        objectName - related object name
        where - the where clause for fetching the related object name MboSet
        expectedCount -
        countFlag -
        userInfo -
      • assertFault

        public static void assertFault(java.lang.Throwable e,
                                       java.lang.String faultType,
                                       java.lang.String group,
                                       java.lang.String key,
                                       boolean okIfAssignable)
        Asserts the fault e is of the type faultType. If the fault type is psdi.util.MXException then the group and key will also be asserted if the values are provided.
        Parameters:
        e -
        faultType -
        group - fault group
        key - fault key
        okIfAssignable - ok if fault not the exact type as faultType but can be assigned from that type.
      • assertFault

        public static void assertFault(java.lang.Throwable e,
                                       java.lang.String faultType,
                                       java.lang.String group,
                                       java.lang.String key,
                                       java.lang.String bmxid,
                                       boolean okIfAssignable,
                                       boolean maxmsgCheck)
        Asserts the fault e is of the type faultType. If the fault type is psdi.util.MXException then the group and key will also be asserted if the values are provided.
        Parameters:
        e - the Throwable object
        faultType - the assert class name of the fault
        group - the assert group [in case of MXException]
        key - the assert group [in case of MXException]
        bmxid - the id [in case of MXException]
        okIfAssignable - ok if fault not the exact type as faultType but can be assigned from that type.
        maxmsgCheck - true would force a check on the maxmessage cache to see if the key is registered
      • assertFault

        public static void assertFault(java.lang.Throwable e,
                                       java.lang.String faultType,
                                       java.lang.String group,
                                       java.lang.String key,
                                       java.lang.String bmxid,
                                       boolean okIfAssignable)
        Asserts the fault e is of the type faultType. If the fault type is psdi.util.MXException then the group and key will also be asserted if the values are provided.
        Parameters:
        e -
        faultType -
        group - fault group
        key - fault key
        bmxid - fault message id
        okIfAssignable - ok if fault not the exact type as faultType but can be assigned from that type.
      • assertWarning

        public static void assertWarning(MboRemote mbo,
                                         java.lang.String warningType,
                                         java.lang.String group,
                                         java.lang.String key)
        Parameters:
        mbo -
        warningType -
        group -
        key -
      • assertWarning

        public static void assertWarning(MboRemote mbo,
                                         java.lang.String warningType,
                                         java.lang.String group,
                                         java.lang.String key,
                                         boolean okIfAssignable)
        Asserts the warning of the type warningType is set in the Mbo. If the warningType is psdi.util.MXException then the group and key will also be asserted if the values are provided.
        Parameters:
        mbo -
        warningType -
        group -
        key -
        okIfAssignable - ok if warning not the exact type as warningType but can be assigned from that type.
      • assertWarning

        public static void assertWarning(MboSetRemote mboSet,
                                         java.lang.String warningType,
                                         java.lang.String group,
                                         java.lang.String key)
        Parameters:
        mboSet -
        warningType -
        group -
        key -
      • assertWarning

        public static void assertWarning(MboSetRemote mboSet,
                                         java.lang.String warningType,
                                         java.lang.String group,
                                         java.lang.String key,
                                         boolean okIfAssignable)
        Parameters:
        mboSet -
        warningType -
        group -
        key -
        okIfAssignable -
      • isNull

        public static boolean isNull(java.lang.String value)
      • assertMaxVarIsFalse

        public static void assertMaxVarIsFalse(java.lang.String orgSite,
                                               java.lang.String varName)
                                        throws java.rmi.RemoteException,
                                               MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • assertMaxVarIsTrue

        public static void assertMaxVarIsTrue(java.lang.String orgSite,
                                              java.lang.String varName)
                                       throws java.rmi.RemoteException,
                                              MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • assertMaxVarHasValue

        public static void assertMaxVarHasValue(java.lang.String orgSite,
                                                java.lang.String varName,
                                                java.lang.String value)
                                         throws java.rmi.RemoteException,
                                                MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • assertMaxVarHasValue

        public static void assertMaxVarHasValue(java.lang.String orgSite,
                                                java.lang.String varName,
                                                boolean value)
                                         throws java.rmi.RemoteException,
                                                MXException
        Throws:
        java.rmi.RemoteException
        MXException