ilog.rules.monitor

Class IlrMonitorJunitTestCase

  • java.lang.Object
    • junit.framework.Assert
      • junit.framework.TestCase
        • ilog.rules.monitor.IlrMonitorJunitTestCase
  • All Implemented Interfaces:
    junit.framework.Test


    public class IlrMonitorJunitTestCase
    extends junit.framework.TestCase
    Utility class to implement test cases with JUnit ( cf : http://www.junit.org/ ). Extends this class to implement tests that can fail because of concurrency issues.
    Since:
    JRules 7.0
    See Also:
    IlrMonitorLocalTool
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void assertClassNotInvolvedInContentionPointStackTrace(java.lang.String message, java.lang.String fullyQualifiedClassName)
      Asserts that no contention occurs in calls made by a specific class.
      void assertInstanceOfThisClassArentLock(java.lang.String message, java.lang.String fullyQualifiedClassName)
      Asserts that any instances of a specific class is used as a lock.
      void assertMethodNotInvolvedInContentionPointStackTrace(java.lang.String message, java.lang.String fullyQualifiedMethodName)
      Asserts that no contention occurs in calls made by a specific method.
      void assertNoContentionDetected(java.lang.String message)
      Asserts that no contention occurs.
      void assertNoContentionPointInThisClass(java.lang.String message, java.lang.String fullyQualifiedClassName)
      Asserts that no contention occurs in a specific class.
      void assertNoContentionPointInThisPackage(java.lang.String message, java.lang.String fullyQualifiedPackageName)
      Asserts that no contention occurs in a specific package.
      void assertNoContentionPointOnThisMethod(java.lang.String message, java.lang.String fullyQualifiedMethodName)
      Asserts that no contention occurs in a specific method.
      void assertNumberOfContentionPointsEquals(java.lang.String message, int number)
      Asserts the the number of contention point detected is equal to a specific number.
      void assertNumberOfContentionPointsInThisClass(java.lang.String message, java.lang.String fullyQualifiedClassName, int number)
      Assert that the number of contention point detected in a specific class is equal to a specific number.
      void assertPackageInvolvedInContentionPointStackTrace(java.lang.String message, java.lang.String fullyQualifiedPackageName)
      Asserts that any class of specific package is involved in a contention.
      void initializeMonitorTestCase(int depth, long intervalMs)
      Call this method at the beginning of a test method.
      void initializeMonitorTestCase(int depth, long intervalMs, java.util.EnumSet<java.lang.Thread.State> threadStates, long[] excludedThs)
      Call this method at the beginning of a test method.
      boolean isMonitoring()
      Returns the monitoring state.
      void stopMonitoring()
      Call this method before making any concurrency assertion.
      • Methods inherited from class junit.framework.TestCase

        assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
      • Methods inherited from class java.lang.Object

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

      • IlrMonitorJunitTestCase

        public IlrMonitorJunitTestCase(java.lang.String string)
    • Method Detail

      • initializeMonitorTestCase

        public void initializeMonitorTestCase(int depth,
                                     long intervalMs,
                                     java.util.EnumSet<java.lang.Thread.State> threadStates,
                                     long[] excludedThs)
        Call this method at the beginning of a test method.
        Parameters:
        depth - value of stack trace depth. It means the number of stack elements in a stack trace.
        intervalMs - interval in milliseconds between two snapshots.
        threadStates - EnumSet of thread state that should be monitored.
        excludedThs - array of long of thread ids that shouldn't be monitored.
      • initializeMonitorTestCase

        public void initializeMonitorTestCase(int depth,
                                     long intervalMs)
        Call this method at the beginning of a test method. It will enable the detection of thread blocked, waiting, or waiting a timer. And it will disable the monitoring for the current thread.
        Parameters:
        depth - value of stack trace depth. It means the number of stack elements in a stack trace.
        intervalMs - interval in milliseconds between two snapshots.
      • stopMonitoring

        public void stopMonitoring()
        Call this method before making any concurrency assertion.
      • isMonitoring

        public boolean isMonitoring()
        Returns the monitoring state.
        Returns:
        true if thread monitoring is active.
      • assertNoContentionDetected

        public void assertNoContentionDetected(java.lang.String message)
        Asserts that no contention occurs.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
      • assertNoContentionPointInThisClass

        public void assertNoContentionPointInThisClass(java.lang.String message,
                                              java.lang.String fullyQualifiedClassName)
        Asserts that no contention occurs in a specific class.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedClassName - a fully qualified class name.
      • assertClassNotInvolvedInContentionPointStackTrace

        public void assertClassNotInvolvedInContentionPointStackTrace(java.lang.String message,
                                                             java.lang.String fullyQualifiedClassName)
        Asserts that no contention occurs in calls made by a specific class. It is sensible to the stack trace depth parameter.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedClassName - a fully qualified class name.
      • assertNoContentionPointOnThisMethod

        public void assertNoContentionPointOnThisMethod(java.lang.String message,
                                               java.lang.String fullyQualifiedMethodName)
        Asserts that no contention occurs in a specific method.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedMethodName - a fully qualified method name.
      • assertMethodNotInvolvedInContentionPointStackTrace

        public void assertMethodNotInvolvedInContentionPointStackTrace(java.lang.String message,
                                                              java.lang.String fullyQualifiedMethodName)
        Asserts that no contention occurs in calls made by a specific method. It is sensible to the stack trace depth parameter.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedMethodName - a fully qualified method name.
      • assertNoContentionPointInThisPackage

        public void assertNoContentionPointInThisPackage(java.lang.String message,
                                                java.lang.String fullyQualifiedPackageName)
        Asserts that no contention occurs in a specific package.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedPackageName - a fully qualified package name.
      • assertPackageInvolvedInContentionPointStackTrace

        public void assertPackageInvolvedInContentionPointStackTrace(java.lang.String message,
                                                            java.lang.String fullyQualifiedPackageName)
        Asserts that any class of specific package is involved in a contention. It is sensible to the stack trace depth parameter.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedPackageName - a fully qualified package name.
      • assertInstanceOfThisClassArentLock

        public void assertInstanceOfThisClassArentLock(java.lang.String message,
                                              java.lang.String fullyQualifiedClassName)
        Asserts that any instances of a specific class is used as a lock.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedClassName - a fully qualified class name.
        See Also:
        Object.wait()
      • assertNumberOfContentionPointsEquals

        public void assertNumberOfContentionPointsEquals(java.lang.String message,
                                                int number)
        Asserts the the number of contention point detected is equal to a specific number.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        number - the contention point's number expected.
      • assertNumberOfContentionPointsInThisClass

        public void assertNumberOfContentionPointsInThisClass(java.lang.String message,
                                                     java.lang.String fullyQualifiedClassName,
                                                     int number)
        Assert that the number of contention point detected in a specific class is equal to a specific number.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        fullyQualifiedClassName - a fully qualified class name.
        number - the contention point's number expected.

© Copyright IBM Corp. 1987, 2017