Unit Test Coverage

The SBLIM CIM Client for Java ships with a large collection of around 100 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.
testClosePULL/SAX/DOM Starts iterating over an enumerateClasses XML response and closes, the iterator before the last element is iterated. The testcase failes 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 failes.
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.

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, failes 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 failes if Expcetion 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 intances with badly formed unsignificant year fields and failes 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 intances with badly formed month fields and failes 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 intances with badly formed day fields and failes 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 intances with badly formed hour fields and failes 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 intances with badly formed minute fields and failes 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 intances with badly second month fields and failes 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 intances with badly formed microseconds fields and failes 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 monthes.
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 testes 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 severel instances with wrong String constructor parameters, the testcase failes 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.

wbem.TrailerTest

test0SAX/PULL/DOM Parses a http CIM-XML message which contains a http trailer with an error message. The testcase failes 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.
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.

logging.LogAndTraceBrokerTest

testMessage1 Tests if a log message is forwarded correctly to the log&trace listeners. This test checks the message level, locale, parameter.
testMessage2 Tests if a log message containing an exception is forwarded correctly to the log&trace listeners. This test checks the message level, locale, exception parameter.
testTrace Tests if a log message is forwarded correctly to the log&trace listeners. This test checks the message level, locale, exception parameter.

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.

http.SSLConfigurationTest

testBasicConnect Tests basic SSL connection.
testClientTrust Test if the client correctly evaluates the authentification of the server.
Uses four keystores: keystore and stranger contain a full private/public key each; truststore contains the public key from keystore; notrust is empty
testServerTrust Test if the server correctly evaluates the authentification of the client.
Uses four keystores: keystore and stranger contain a full private/public key each; truststore contains the public key from keystore; notrust is empty

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.