Unit Test Coverage

The SBLIM CIM Client for Java ships with a large collection of around 200 unit tests. Whenever you the "all" target is build with ant the complete unit test suite will be executed. This document describes what is covered by these tests.

In addition to unit tests we have a function test package. This is not yet published or documented, but will be in one of the next releases.

The unit tests are all self-contained, there's is no external dependency. In contradiction our function test is executed against various CIMOM backends.

The Test Cases

wbem.CloseableIteratorTest

testEnumerateClassesPULL/SAX/DOM Parses a saved enumerateClasses XML response, iterates over it and checks that it matches with the reference data.
testEnumerateClassesErrorPULL/SAX/DOM Parses a saved enumerateClasses XML response that contains CIM_Error instances within an ERROR node, checks that it matches with the reference data.
testClosePULL/SAX/DOM Starts iterating over an enumerateClasses XML response and closes, the iterator before the last element is iterated. The testcase fails if the next CloseableIterator.hasNext() returns true.

wbem.XMLHostStrTest

testSAX/DOM Checks that XMLHostStr is integrated well into the XML parsers.
test Tests XMLHostStr directly with a large number of sample data.

wbem.ParserTest

testEnumClassesDOM/SAX/PULL Builds an enumerateClasses XML response from sample data, than parses it and checks that it matches with the sample data.
testEnumInstancesDOM/SAX/PULL Builds an enumerateInstances XML response from sample data, than parses it and checks that it matches with the sample data.
testAssociatorClassNamesDOM/SAX/PULL Builds an associatorClassNames XML response from sample data, than parses it and checks that it matches with the sample data.
testAssociatorInstanceNamesDOM/SAX/PULL Builds an associatorInstanceNames XML response from sample data, than parses it and checks that it matches with the sample data.
testAssocClassesDOM/SAX/PULL Builds an associatorClassNames XML response from sample data, than parses it and checks that it matches with the sample data.
testAssocInstancesDOM/SAX/PULL Builds an associatorInstances XML response from sample data, than parses it and checks that it matches with the sample data.
testEnumQualiTypesDOM/SAX/PULL Builds an enumerateQualifierTypes XML response from sample data, than parses it and checks that it matches with the sample data.
testMethodRspSAX/DOM Builds MethodResponse XML data from sample data, than parses it and checks that it matches with the sample data.
testSVCMethodRsp0SAX/DOM Parses a hand edited SVC MethodResponse XML file and checks that it matches with the sample data.
testSVCMethodRspSmpl0SAX/DOM Parses a captured SVC MethodResponse XML file and checks that it matches with the sample data.

wbem.SVCTest

testGetClassSAX/PULL/DOM Parses a hand made SVC getClass() response XML file and checks that it matches with the sample data.
testGetClassSAX/PULL/DOM Parses a hand made SVC enumerateQualifierTypes() response XML file and checks that it matches with the sample data.

wbem.EmbeddedObjParsingTest

testGetInstanceDOM/SAX/PULL Parses a getInstance XML response which contains Embedded Objects, than checks that it matches with the sample data.
testNegativeGetInstanceDOM/SAX/PULL Parses a getInstance XML response which contains an Embedded class with an EmbeddedObject="instance" attribute, if the parsing doesn't throw an Exception the testcase fails.
testGetClassDOM/SAX/PULL Parses a getClass XML response which contains Embedded Objects, than checks that it matches with the sample data.
testMethodRsp Parses a methodResponse XML request, with SAX, which contains Embedded Objects, than checks that it matches with the sample data.
testMethodRspDOM Parses a methodResponse XML request, with DOM, which contains Embedded Objects, than checks that it matches with the sample data.
testSVCMethodRspSAX/DOM Checks that the XML parsers are able to parse SVC CIMOM's wrongly built RETURNVALUE types as CIMDataType.STRING_T.

wbem.EmbeddedObjBuildingTest

testCIMClass Builds an enumerateClasses XML response from a sample class, than parses the built XML and checks that the result is matched with the sample class.

wbem.Bug3466280Test

testEnumInstancesSAX/PULL/DOM Parses a hand made enumerateInstances() response XML file and checks that the INSTANCENAME elements contain or do not contain a namespace as expected.

wbem.Bug3598613Test

testEnumInstancesSAX/PULL/DOM Parses a hand made enumerateInstances() response XML file and checks that the numeric key data types of an instance's CIMObjectPath match the corresponding keys in the instance's CIMProperty[] when the sblim.wbem.synchronizeNumericKeyDataTypes is set to true.

wbem.NestedEmbInstTest

testEnumInstancesSAX/PULL/DOM Parses a hand made enumerateInstances() response XML file and checks that the embedded instances (that is, an instance within an instance within an instance) are as expected.
testNestedEmbInstBuilder Builds createInstance() request XML files and checks that the embedded instances (that is, an instance within an instance within an instance) are as expected.

wbem.IReturnValueTest

testSAX/PULL/DOM Parses a hand made enumerateInstanceNames() response XML string and checks that the IRETURNVALUE element is parsed properly when it contains a VALUE, VALUE.ARRAY and VALUE.REFERENCE child element.

wbem.DSP0201Test

testValidCIMXMLRequests Parses over 140 hand made valid request XML strings with each of the three parsers and checks that the expected "not-a-response" parsing exception is thrown.
testInvalidCIMXMLRequests Parses over 135 hand made invalid request XML strings with each of the three parsers and checks that the expected parsing exception is thrown.
testValidCIMXMLResponses Parses over 250 hand made valid response XML strings with each of the three parsers and checks that no parsing exception is thrown.
testInvalidCIMXMLResponses Parses over 175 hand made invalid response XML strings with each of the three parsers and checks that the expected parsing exception is thrown.

wbem.WBEMClientTest

testClientIsActive Tests isActive before initialization, after initialization but before closing, and after closing.
testValidSendIndication Tests sendIndication to make sure indications are properly sent by the client for valid invocations.
testInvalidSendIndication Tests sendIndication to make sure exceptions are properly thrown by the client for invalid invocations.
testClientGzipEncoding Tests request/response to make sure gzip encoding of CIM-XML works as expected.

wbem.WBEMListenerTest

testListenerInstance Tests that WBEMListenerFactory returns unique instances of WBEMListener.
testListenerBlockedIPs Tests WBEMListenerSBLIM methods getBlockedIPs and setBlockedIPs.

cim.CIMDataTypeTest

testScalarDataTypes Tests scalar CIMDataTypes (UINT8_T, UINT16_T, etc.) along with CIMHelper.ScalarDataType.
testUnboundedArrayDataTypes Tests unbounded array CIMDataTypes (UINT8_ARRAY_T, UINT16_ARRAY_T, etc.) along with CIMHelper.UnboundedArrayDataType.
testBoundedArrayDataTypes Tests bounded array CIMDataTypes (UINT8_ARRAY_T, UINT16_ARRAY_T, etc.) along with CIMHelper.UnboundedArrayDataType.
testReferenceType Tests scalar, bounded array and unbounded array reference CIMDataTypes with valid class name, empty class name and null class name.
testGetDataType Tests the static getDataType method.

cim.CIMDateTimeAbsoluteTest

testCalendarConstructor Builds up a CIMDateTimeAbsolute with the Calendar constructor, than checks that the values by the getters are matched with the values contained in the Calendar. Builds a CIMDateTimeAbsolute with a Calendar, which year value is over the limit, fails if Exception is not thrown.
testStringConstructor Builds a CIMDateTimeAbsolute instance with the String constructor, than checks that the getters provide good values.
testStringConstructorNegative Tries to build several instances by passing badly formatted values to the String constructor. The testcase fails if Exception is not thrown.
testUnsignificantYear Builds an instance with the String constructor by passing a value where the year is unsignificant. The getters are checked. Then tries to build instances with badly formed unsignificant year fields and fails if Exceptions are not thrown.
testMonth Builds an instance with the String constructor by passing value where the month is unsignificant. The getters are checked. Then tries to build instances with badly formed month fields and fails if Exceptions are not thrown.
testDay Builds an instance with the String constructor by passing value where the day is unsignificant. The getters are checked. Then tries to build instances with badly formed day fields and fails if Exceptions are not thrown.
testHour Builds an instance with the String constructor by passing value where the hour is unsignificant. The getters are checked. Then tries to build instances with badly formed hour fields and fails if Exceptions are not thrown.
testMinute Builds an instance with the String constructor by passing value where the minute is unsignificant. The getters are checked. Then tries to build instances with badly formed minute fields and fails if Exceptions are not thrown.
testSec Builds an instance with the String constructor by passing value where the second is unsignificant. The getters are checked. Then tries to build instances with badly second month fields and fails if Exceptions are not thrown.
testUSec Builds an instance with the String constructor by passing value where the microseconds is unsignificant. The getters are checked. Then tries to build instances with badly formed microseconds fields and fails if Exceptions are not thrown.
testUTC Does negative tests with the String constructor and badly formed UTC values.
testCompareUTC Checks that compareTo() works for UTC.
testCompareUSec Checks that compareTo() works for microseconds.
testCompareSec Checks that compareTo() works for seconds.
testCompareMin Checks that compareTo() works for minutes.
testCompareHour Checks that compareTo() works for hours.
testCompareDay Checks that compareTo() works for days.
testCompareMonth Checks that compareTo() works for months.
testCompareYear Checks that compareTo() works for years.

cim.CIMDateTimeIntervalTest

testIntConstructor Creates an instance with the int constructor and checks the getters. Creates several instances with unsignificant fields and checks toString(). Checks that the int constructor throws Exception for invalid values.
testLongConstructor Makes an instance with the long constructor and checks the getters. Negative tests are also done by calling the constructor with values outside the limits.
testStrConstructor Creates an instance with the String constructor and checks the getters. Tries to make several instances with wrong String constructor parameters, the testcase fails if Exception is not thrown for the wrong values.
testDays Checks that compareTo() works for days.
testHours Checks that compareTo() works for hours.
testMins Checks that compareTo() works for minutes.
testSecs Checks that compareTo() works for seconds.
testUSecs Checks that compareTo() works for microseconds.
testTotalMSecs Checks that getTotalMilliseconds() works.

cim.CIMInstanceDataTypeTest

testDeriveInstanceProperties Tests CIMInstance.deriveInstance.
testNumericKeys Tests CIMHelper.CIMInstanceWithSynchonizedNumericKeyDataTypes.

wbem.TrailerTest

test0SAX/PULL/DOM Parses an HTTP CIM-XML message which contains an HTTP trailer with an error message. The testcase fails if CloseableIterator.hasNext() doesn't throw a RuntimeException or if the thrown RuntimeException's cause is not the expected WBEMException.

wbem.ValueTypeTest

testSAX/PULL/DOM Verifies that the types of key CIMProperties with VALUETYPE XML attribute are parsed correctly.

wbem.ModifyInstanceTest

testWithPropList Builds a modifyInstance CIM-XML request with a property list. Than parses the request and checks it.
testWithEmptyPropList Builds a modifyInstance CIM-XML request with a empty property list. Than parses the request and checks it.
testWithNullPropList Builds a modifyInstance CIM-XML request with a null property list. Than parses the request and checks it.

cim.CIMObjectPathTest

testEquals Creates a bunch of strictly content equal, equal in terms of JSR48 and not equal object paths. Checks if the equals method gives to correct results.
testEqualsModelPath Checks if the equalsModelPath method gives the correct results for two object paths with the same model path but different namespace paths.
testConstructors Tests the full and the WBEM-URI string constructors of CIMObjectPath. Builds CIMObjectPath instances with sample WBEM-URI fields, using both constructors, than checks that the getters of the instances provide good values.
testObjectPaths Tests the WBEM-URI string constructor and toString method of CIMObjectPath to make sure input matches output using both untyped and typed object paths.

logging.LogAndTraceBrokerTest

testInternalListeners Tests if all three internal listeners come up correctly and that isLoggable works correctly.
testExternalListeners Tests if external listeners come up correctly and that isLoggable works correctly.
testListeners Tests if all three internal listeners and external listeners come up correctly, that they can be removed successfully and that isLoggable works correctly in all cases.
testMessage1 Tests if a log message is forwarded correctly to the loginvalid input: '&trace' listeners. This test checks the message level, locale, parameter.
testMessage2 Tests if a log message containing an exception is forwarded correctly to the loginvalid input: '&trace' listeners. This test checks the message level, locale, exception parameter.
testTrace Tests if a log message is forwarded correctly to the loginvalid input: '&trace' listeners. This test checks the message level, locale, exception parameter.
testCIMXMLTrace Tests if a log message is forwarded correctly to the CIM-XML trace listeners. This test checks the message level, message and outgoing indicator.

util.WBEMConfigurationTest

testLoadGlobalConfiguration Tests loadGlobalConfiguration(). First is checked if the attempt to load a non-existing file fails correctly. Second an existing file is loaded and the resulting change of a configuration property verified.
testDefault Test fall back to defaults.
testOverride Tests overriding of properties.
testSetAndGet Test setter and getters.
testClient Tests if the settings are picked up by the client.

util.BadDoubleStringsTest

testDoubleStrings Tests Util.isBadDoubleString().

http.SSLConfigurationTest

testBasicConnect Tests basic SSL connection.
testClientTrust Test if the client correctly evaluates the authentication of the server. Uses four keystores: keystore and stranger contain a full private/public key each; truststore contains the public key from keystore; notrust contains an untrusted certificate
testServerTrust Test if the server correctly evaluates the authentication of the client. Uses four keystores: keystore and stranger contain a full private/public key each; truststore contains the public key from keystore; notrust contains an untrusted certificate
testWBEMClientTrust Similar to testClientTrust but uses true WBEMClient and WBEMListener instances to perform the test
testWBEMListenerTrust Similar to testServerTrust but uses true WBEMClient and WBEMListener instances to perform the test

cimxml.CimXmlSerializerTest

testSerializer Tests the CimXmlSerializer with a DOM document contains all kind of white space and special characters.

discovery.DiscovererSLPTest

testFindWbemServices Sets up a SLP SA, registers fake services and checks afterwards if these are correctly discovered by the findWBEMServices() method.

discovery.WBEMServiceAdvertisementSLPTest

testAdvertisement Builds a bunch of advertisements and verifies that the getters return correct data and the createClient() method works properly.

discovery.AdvertisementCatalogTest

testAddAndGet Tests addAdvertisements(), getKnownIds() and getAdvertisementsById()
testSelection Tests the selection algorithm of getAdvertisement()
testRefresh Tests refreshAdvertisements()
testListeners Tests listener registration, deregistration and events

http.HttpClientTest

testCustomSocketFactory Tests custom socket factory setting.

http.HttpHeaderTest

testExamineTrailer Tests examineTrailer(). Several HTTP trailers are created and checked if the trailer exceptions are thrown only when expected and that status codes and description are correctly set in the exception.

http.HttpChallengeTest

testValidChallenges Tests Challenge.parseChallenge() with several valid challenges and checks that the number of challenges along with each challenge's scheme and realm are correctly set.
testInvalidChallenges Tests Challenge.parseChallenge() with several invalid challenges and checks if exceptions are thrown only when expected.

cim.CIMOctetStringTest

testByteConstructorGood Tests valid invocations of the CIMOctetString(UnsignedInteger8[]) constructor by examining return values from getASCIIString() and getHexString().
testHexConstructorGood Tests valid invocations of the CIMOctetString(String, true) constructor by examining return values from getASCIIString() and getBytes().
testAsciiConstructorGood Tests valid invocations of the CIMOctetString(String, false) constructor by examining return values from getHexString() and getBytes().
testByteConstructorBad Tests invalid invocations of the CIMOctetString(UnsignedInteger8[]) constructor by expecting IllegalArgumentExceptions.
testHexConstructorBad Tests invalid invocations of the CIMOctetString(String, true) constructor by expecting IllegalArgumentExceptions.
testAsciiConstructorBad Tests invalid invocations of the CIMOctetString(String, false) constructor by expecting IllegalArgumentExceptions.
testEquals Tests valid and invalid invocations of the equals() and hashCode() methods.