Class EPPCodecTst

  • All Implemented Interfaces:
    junit.framework.Test

    public class EPPCodecTst
    extends junit.framework.TestCase
    Is a unit test of the com.verisign.epp.codec.gen package. The unit test will execute, gather statistics, and output the results of a test of each com.verisign.epp.codec.gen package concrete EPPMessage's and their expected EPPResponse. The unit test is dependent on the use of JUNIT 3.5

    The test EPPResponse is duplicated for EPPMessage that do not contain a specialized EPPResponse to provide an example of a full EPPMessage transaction. All of the com.verisign.epp.codec.gen package EPPMessage classes are associated with EPPResponse.

    • Constructor Summary

      Constructors 
      Constructor Description
      EPPCodecTst​(java.lang.String aName)
      Allocates an EPPCodecTst with a logical name.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void initEnvironment()
      Initialize the SDK environment based on the system properties:

      validate - true or false value indicating if XML schema validation is enabled.
      static void main​(java.lang.String[] args)
      Unit test main, which accepts the following system property options:
      iterations Number of unit test iterations to run validate Turn XML validation on (true) or off ( false).
      static void printEnd​(java.lang.String aTest)
      Print the end of a test with the Thread name if the current thread is a TestThread.
      static void printStart​(java.lang.String aTest)
      Print the start of a test with the Thread name if the current thread is a TestThread.
      static void setNumIterations​(long aNumIterations)
      Sets the number of iterations to run per test.
      protected void setUp()
      JUNIT setUp method, which sets the default client Id to "theRegistrar".
      static junit.framework.Test suite()
      JUNIT suite static method, which returns the tests associated with EPPCodecTst.
      protected void tearDown()
      JUNIT tearDown, which currently does nothing.
      void testCommandGetExtensionFailOnDuplicate()
      Unit test for using EPPCommand.getExtension(Class, boolean).
      static EPPEncodeDecodeStats testEncodeDecode​(EPPMessage aMessage)
      Reusable unit test algorithm, which does the following:

      encodes the EPPMessage in XML decodes the EPPMessage from XML Serializes EPPMessage using Java Serialization De-serializes EPPMessage using Java Serialization Gathers unit test statistics and output them to standard out
      void testFindDuplicateExtNamespaces()
      Unit test of using {code EPPUtil.findDuplicateExtNamespaces(List)} and the corresponding EPPCommand.findDuplicateExtNamespaces() and EPPResponse.findDuplicateExtNamespaces().
      void testFindExtNamespaces()
      Unit test of using EPPUtil.testFindExtNamespaces(List, List) and the corresponding EPPCommand.testFindExtNamespaces(List) and EPPResponse.testFindExtNamespaces(List).
      void testFindExtNamespaceSuffixes()
      Unit test of using EPPUtil.testFindExtNamespaceSuffixes(List, List) and the corresponding EPPCommand.testFindExtNamespaceSuffixes(List) and EPPResponse.testFindExtNamespaceSuffixes(List).
      void testFindUnsupportedExtNamespaces()
      Unit test of using EPPUtil.findUnsupportedExtNamespaces(List, List) and the corresponding EPPCommand.findUnsupportedExtNamespaces(List) and EPPResponse.findUnsupportedExtNamespaces(List).
      void testFindUnsupportedExtNamespaceSuffixes()
      Unit test of using EPPUtil.findUnsupportedExtNamespaceSuffixes(List, List) and the corresponding EPPCommand.findUnsupportedExtNamespaceSuffixes(List) and EPPResponse.findUnsupportedExtNamespaceSuffixes(List).
      void testGreeting()
      Unit test of EPPGreeting.
      void testHello()
      Unit test of EPPHello.
      void testLogin()
      Unit test of EPPLoginCmd.
      void testLogout()
      Unit test of EPPLogoutCmd.
      void testPoll()
      Unit test of EPPPollCmd.
      void testResponse()
      Unit test of EPPResponse.
      void testResponseGetExtensionFailOnDuplicate()
      Unit test for using {code EPPResponse.getExtension(Class, boolean)}.
      void testTimeInstantFormat()
      Test the encoding and decoding of the timeInstantFormat supported by the EPPUtil.encodeTimeInstant(Date) and EPPUtil.decodeTimeInstant(String).
      void testUnhandledNamespaces()
      Test unhandled namespaces poll message, which is a poll message that contains EPP extensions (object or command / response) that are not supported by the client based on the client login services.
      static void testXMLEncodeDecode​(EPPMessage aMessage, EPPEncodeDecodeStats aStats)
      Tests the encoding and decoding of an EPPMessage.
      • 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, toString
      • Methods inherited from class java.lang.Object

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

      • EPPCodecTst

        public EPPCodecTst​(java.lang.String aName)
        Allocates an EPPCodecTst with a logical name. The constructor will initialize the base class TestCase with the logical name.
        Parameters:
        aName - Logical name of the test
    • Method Detail

      • testGreeting

        public void testGreeting()
        Unit test of EPPGreeting. There is no response associated with EPPGreeting other than a EPPLoginCmd which is testing in testLogin.

        This test will be invoked by JUNIT, since it is prefixed with "test" and is a public method.
      • testLogin

        public void testLogin()
        Unit test of EPPLoginCmd. The response to EPPLoginCmd is EPPResponse.
        This test will be invoked by JUNIT, since it is prefixed with "test" and is a public method.
      • testLogout

        public void testLogout()
        Unit test of EPPLogoutCmd. The response to EPPLogoutCmd is EPPResponse.
        This test will be invoked by JUNIT, since it is prefixed with "test" and is a public method.
      • testResponse

        public void testResponse()
        Unit test of EPPResponse. This will test EPPResponse with various attribute values.
        This test will be invoked by JUNIT, since it is prefixed with "test" and is a public method.
      • testUnhandledNamespaces

        public void testUnhandledNamespaces()
        Test unhandled namespaces poll message, which is a poll message that contains EPP extensions (object or command / response) that are not supported by the client based on the client login services.
      • testCommandGetExtensionFailOnDuplicate

        public void testCommandGetExtensionFailOnDuplicate()
        Unit test for using EPPCommand.getExtension(Class, boolean).
      • testFindDuplicateExtNamespaces

        public void testFindDuplicateExtNamespaces()
        Unit test of using {code EPPUtil.findDuplicateExtNamespaces(List)} and the corresponding EPPCommand.findDuplicateExtNamespaces() and EPPResponse.findDuplicateExtNamespaces(). Test the following:
        1. Test that no duplicates are found
        2. Test that duplicates are found when there are a single set of duplicates
        3. Test that multiple duplicate instances result in the same set of found duplicates.
      • testFindUnsupportedExtNamespaces

        public void testFindUnsupportedExtNamespaces()
        Unit test of using EPPUtil.findUnsupportedExtNamespaces(List, List) and the corresponding EPPCommand.findUnsupportedExtNamespaces(List) and EPPResponse.findUnsupportedExtNamespaces(List). Test the following:
        1. Test that no unsupported extensions found
        2. Test that there is an unsupported extension.
        3. Test that all extensions are unsupported.
      • testFindUnsupportedExtNamespaceSuffixes

        public void testFindUnsupportedExtNamespaceSuffixes()
        Unit test of using EPPUtil.findUnsupportedExtNamespaceSuffixes(List, List) and the corresponding EPPCommand.findUnsupportedExtNamespaceSuffixes(List) and EPPResponse.findUnsupportedExtNamespaceSuffixes(List). Test the following:
        1. Test that no unsupported extensions found
        2. Test that there is an unsupported extension.
        3. Test that all extensions are unsupported.
        4. Test inclusion of an unsupported namespace.
      • testResponseGetExtensionFailOnDuplicate

        public void testResponseGetExtensionFailOnDuplicate()
        Unit test for using {code EPPResponse.getExtension(Class, boolean)}.
      • testFindExtNamespaces

        public void testFindExtNamespaces()
        Unit test of using EPPUtil.testFindExtNamespaces(List, List) and the corresponding EPPCommand.testFindExtNamespaces(List) and EPPResponse.testFindExtNamespaces(List). Test the following:
        1. Test that it doesn't fail with no extensions.
        2. Test with many extensions.
        3. Test the filtering of extensions.
      • testFindExtNamespaceSuffixes

        public void testFindExtNamespaceSuffixes()
        Unit test of using EPPUtil.testFindExtNamespaceSuffixes(List, List) and the corresponding EPPCommand.testFindExtNamespaceSuffixes(List) and EPPResponse.testFindExtNamespaceSuffixes(List). Test the following:
        1. Test that it doesn't fail with no extensions.
        2. Test with many extensions.
        3. Test the filtering of extensions.
      • setUp

        protected void setUp()
        JUNIT setUp method, which sets the default client Id to "theRegistrar".
        Overrides:
        setUp in class junit.framework.TestCase
      • tearDown

        protected void tearDown()
        JUNIT tearDown, which currently does nothing.
        Overrides:
        tearDown in class junit.framework.TestCase
      • initEnvironment

        public static void initEnvironment()
        Initialize the SDK environment based on the system properties:

        • validate - true or false value indicating if XML schema validation is enabled. The default value is true
        • fullschemachecking - true or false value indicating if full XML schema validation is enabled. The default value is true.
        • logfile - Log file name. The default value is epp.log.

        Both the Environment class and the logging will be initialized.
      • suite

        public static junit.framework.Test suite()
        JUNIT suite static method, which returns the tests associated with EPPCodecTst.
        Returns:
        Test suite
      • main

        public static void main​(java.lang.String[] args)
        Unit test main, which accepts the following system property options:
        • iterations Number of unit test iterations to run
        • validate Turn XML validation on (true) or off ( false). If validate is not specified, validation will be off.
        Parameters:
        args - DOCUMENT ME!
      • printStart

        public static void printStart​(java.lang.String aTest)
        Print the start of a test with the Thread name if the current thread is a TestThread.
        Parameters:
        aTest - name for the test
      • printEnd

        public static void printEnd​(java.lang.String aTest)
        Print the end of a test with the Thread name if the current thread is a TestThread.
        Parameters:
        aTest - name for the test
      • testXMLEncodeDecode

        public static void testXMLEncodeDecode​(EPPMessage aMessage,
                                               EPPEncodeDecodeStats aStats)
                                        throws EPPException
        Tests the encoding and decoding of an EPPMessage. If there is an error with encoding or decoding the message, an EPPException will be thrown.
        Parameters:
        aMessage - Message to test the XML encoding and decoding
        aStats - Testing statistics. Pass null for no statistics to be gathered.
        Throws:
        EPPException - Error encoding or decoding the message
      • testEncodeDecode

        public static EPPEncodeDecodeStats testEncodeDecode​(EPPMessage aMessage)
        Reusable unit test algorithm, which does the following:

        • encodes the EPPMessage in XML
        • decodes the EPPMessage from XML
        • Serializes EPPMessage using Java Serialization
        • De-serializes EPPMessage using Java Serialization
        • Gathers unit test statistics and output them to standard out
        Parameters:
        aMessage - EPP Message to test encoding and decoding
        Returns:
        encode and decode statistics
      • setNumIterations

        public static void setNumIterations​(long aNumIterations)
        Sets the number of iterations to run per test.
        Parameters:
        aNumIterations - number of iterations to run per test
      • testHello

        public void testHello()
        Unit test of EPPHello. The response to EPPHello is EPPResponse.
        This test will be invoked by JUNIT, since it is prefixed with "test" and is a public method.
      • testPoll

        public void testPoll()
                      throws javax.xml.parsers.ParserConfigurationException
        Unit test of EPPPollCmd. The response to EPPPollCmd is EPPResponse.
        This test will be invoked by JUNIT, since it is prefixed with "test" and is a public method.
        Throws:
        javax.xml.parsers.ParserConfigurationException - Error creating DOM document.
      • testTimeInstantFormat

        public void testTimeInstantFormat()
        Test the encoding and decoding of the timeInstantFormat supported by the EPPUtil.encodeTimeInstant(Date) and EPPUtil.decodeTimeInstant(String).