Java Reference
In-Depth Information
Let's look at a concrete example. You can find the Apache Felix Configuration
Admin Service integration tests under the it subproject. To run all these tests in
sequence, type the following in the chapter07/testing-example/ directory:
$ ant test.integration
...
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 26.523 sec
...
[junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 24.664 sec
...
[junit] Tests run: 15, Failures: 0, Errors: 0, Time elapsed: 55.839 sec
...
[junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 14.45 sec
...
[junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 13.809 sec
...
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 5.723 sec
You may wonder why there isn't much output during the tests. This is because you've
set the local logging threshold to WARN . To see more details about what Pax Exam
is running, edit the local log4j.properties file, and change the threshold from WARN
to INFO .
Let's take a closer look at one of the integration tests from ConfigurationBaseTest .
Listing 7.5 Basic configure-then-start integration test
@Test
public void test_basic_configuration_configure_then_start()
throws BundleException, IOException
{
final String pid = "test_basic_configuration_configure_then_start";
final Configuration config = configure( pid, null, true );
configuration data B
Sets
bundle = installBundle( pid, ManagedServiceTestActivator.class );
bundle.start();
delay();
final ManagedServiceTestActivator tester =
ManagedServiceTestActivator.INSTANCE;
C
Checks for correct
configuration
TestCase.assertNotNull( tester.props );
TestCase.assertEquals( pid, tester.props.get(
Constants.SERVICE_PID ) );
TestCase.assertNull( tester.props.get(
ConfigurationAdmin.SERVICE_FACTORYPID ) );
TestCase.assertNull( tester.props.get(
ConfigurationAdmin.SERVICE_BUNDLELOCATION ) );
TestCase.assertEquals( PROP_NAME, tester.props.get( PROP_NAME ) );
TestCase.assertEquals( 1, tester.numManagedServiceUpdatedCalls );
config.delete();
delay();
TestCase.assertNull( tester.props );
TestCase.assertEquals( 2, tester.numManagedServiceUpdatedCalls );
}
notification D
Verifies
 
Search WWH ::




Custom Search