Buggy code:
@ Override public void doSetUp ( ) throws Exception { } @ Test public void BlueprintSample ( ) throws Exception { System . out . println ( ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><seq2seq4repair_space>Start<seq2seq4repair_space>Test<seq2seq4repair_space>Blueprint<seq2seq4repair_space>Sample" ) ; long sampleBundleId = - 1 ; long extenderBundleId = - 1 ; for ( Bundle bundle : bundleContext . getBundles ( ) ) { if ( bundle . getSymbolicName ( ) . equals ( "org.apache.aries.blueprint.sample" ) ) sampleBundleId = bundle . getBundleId ( ) ; if ( bundle . getSymbolicName ( ) . equals ( "org.apache.aries.blueprint" ) ) extenderBundleId = bundle . getBundleId ( ) ; } if ( ( - 1 ) == sampleBundleId ) fail ( "Blueprint<seq2seq4repair_space>Sample<seq2seq4repair_space>Bundle<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>found!" ) ; if ( ( - 1 ) == extenderBundleId ) fail ( "Blueprint<seq2seq4repair_space>Extender<seq2seq4repair_space>Bundle<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>found!" ) ; BlueprintStateMBean stateProxy = ( ( BlueprintStateMBean ) ( MBeanServerInvocationHandler . newProxyInstance ( mbeanServer , new ObjectName ( BlueprintStateMBean . OBJECTNAME ) , BlueprintStateMBean . class , false ) ) ) ; long [ ] bpBundleIds = stateProxy . getBlueprintBundleIds ( ) ; assertEquals ( 2 , bpBundleIds . length ) ; BlueprintEventValidator sampleValidator = new BlueprintEventValidator ( sampleBundleId , extenderBundleId , 2 ) ; sampleValidator . validate ( stateProxy . getLastEvent ( sampleBundleId ) ) ; TabularData lastEvents = stateProxy . getLastEvents ( ) ; assertEquals ( OSGI_BLUEPRINT_EVENTS_TYPE , lastEvents . getTabularType ( ) ) ; sampleValidator . validate ( lastEvents . get ( new Long [ ] { sampleBundleId } ) ) ; Bundle sampleBundle = bundleContext . getBundle ( sampleBundleId ) ; String filter = ( ( ( "(&(osgi.blueprint.container.symbolicname=" + ( sampleBundle . getSymbolicName ( ) ) ) + ")(osgi.blueprint.container.version=" ) + ( sampleBundle . getVersion ( ) ) ) + "))" ; ServiceReference [ ] serviceReferences = null ; try { serviceReferences = bundleContext . getServiceReferences ( BlueprintContainer . class . getName ( ) , filter ) ; } catch ( InvalidSyntaxException e ) { throw new RuntimeException ( e ) ; } long sampleBlueprintContainerServiceId = ( ( Long ) ( serviceReferences [ 0 ] . getProperty ( Constants . SERVICE_ID ) ) ) ; BlueprintMetadataMBean metadataProxy = ( ( BlueprintMetadataMBean ) ( MBeanServerInvocationHandler . newProxyInstance ( mbeanServer , new ObjectName ( BlueprintMetadataMBean . OBJECTNAME ) , BlueprintMetadataMBean . class , false ) ) ) ; long [ ] bpContainerServiceIds = metadataProxy . getBlueprintContainerServiceIds ( ) ; assertEquals ( 2 , bpContainerServiceIds . length ) ; assertEquals ( sampleBlueprintContainerServiceId , metadataProxy . getBlueprintContainerServiceId ( sampleBundleId ) ) ; BeanValidator bv_foo = new BeanValidator ( "org.apache.aries.blueprint.sample.Foo" , "init" , "destroy" ) ; BeanPropertyValidator bpv_a = new BeanPropertyValidator ( "a" ) ; bpv_a . setObjectValueValidator ( new ValueValidator ( "5" ) ) ; BeanPropertyValidator bpv_b = new BeanPropertyValidator ( "b" ) ; bpv_b . setObjectValueValidator ( new ValueValidator ( "-1" ) ) ; BeanPropertyValidator bpv_bar = new BeanPropertyValidator ( "bar" ) ; bpv_bar . setObjectValueValidator ( new RefValidator ( "bar" ) ) ; BeanPropertyValidator bpv_currency = new BeanPropertyValidator ( "currency" ) ; bpv_currency . setObjectValueValidator ( new ValueValidator ( "PLN" ) ) ; BeanPropertyValidator bpv_date = new BeanPropertyValidator ( "date" ) ; bpv_date . setObjectValueValidator ( new ValueValidator ( "2009.04.17" ) ) ; bv_foo . addPropertyValidators ( bpv_a , bpv_b , bpv_bar , bpv_currency , bpv_date ) ; bv_foo . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , "foo" ) ) ; BeanPropertyValidator bpv_value = new BeanPropertyValidator ( "value" ) ; bpv_value . setObjectValueValidator ( new ValueValidator ( "Hello<seq2seq4repair_space>FooBar" ) ) ; BeanPropertyValidator bpv_context = new BeanPropertyValidator ( "context" ) ; bpv_context . setObjectValueValidator ( new RefValidator ( "blueprintBundleContext" ) ) ; CollectionValidator cv = new CollectionValidator ( "java.util.List" ) ; cv . addCollectionValueValidators ( new ValueValidator ( "a<seq2seq4repair_space>list<seq2seq4repair_space>element" ) , new ValueValidator ( "5" , "java.lang.Integer" ) ) ; BeanPropertyValidator bpv_list = new BeanPropertyValidator ( "list" ) ; bpv_list . setObjectValueValidator ( cv ) ; BeanValidator bv_bar = new BeanValidator ( "org.apache.aries.blueprint.sample.Bar" ) ; bv_bar . addPropertyValidators ( bpv_value , bpv_context , bpv_list ) ; bv_bar . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , "bar" ) ) ; String [ ] serviceComponentIds = metadataProxy . getComponentIdsByType ( sampleBlueprintContainerServiceId , SERVICE_METADATA ) ; <START_BUG> assertEquals ( "There<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>only<seq2seq4repair_space>one<seq2seq4repair_space>service<seq2seq4repair_space>component<seq2seq4repair_space>in<seq2seq4repair_space>this<seq2seq4repair_space>sample" , 1 , serviceComponentIds . length ) ; <END_BUG> MapEntryValidator mev = new MapEntryValidator ( ) ; mev . setKeyValueValidator ( new ValueValidator ( "key" ) , new ValueValidator ( "value" ) ) ; RegistrationListenerValidator rglrv = new RegistrationListenerValidator ( "serviceRegistered" , "serviceUnregistered" ) ; rglrv . setListenerComponentValidator ( new RefValidator ( "fooRegistrationListener" ) ) ; ServiceValidator sv = new ServiceValidator ( 4 ) ; sv . setServiceComponentValidator ( new RefValidator ( "foo" ) ) ; sv . addMapEntryValidator ( mev ) ; sv . addRegistrationListenerValidator ( rglrv ) ; sv . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , serviceComponentIds [ 0 ] ) ) ; BeanValidator bv_fooRegistrationListener = new BeanValidator ( "org.apache.aries.blueprint.sample.FooRegistrationListener" ) ; bv_fooRegistrationListener . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , "fooRegistrationListener" ) ) ; ReferenceListenerValidator rlrv_1 = new ReferenceListenerValidator ( "bind" , "unbind" ) ; rlrv_1 . setListenerComponentValidator ( new RefValidator ( "bindingListener" ) ) ; ReferenceValidator rv = new ReferenceValidator ( "org.apache.aries.blueprint.sample.InterfaceA" , 100 ) ; rv . addReferenceListenerValidator ( rlrv_1 ) ; rv . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , "ref2" ) ) ; BeanValidator bv_bindingListener = new BeanValidator ( "org.apache.aries.blueprint.sample.BindingListener" ) ; bv_bindingListener . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , "bindingListener" ) ) ; ReferenceListenerValidator rlrv_2 = new ReferenceListenerValidator ( "bind" , "unbind" ) ; rlrv_2 . setListenerComponentValidator ( new RefValidator ( "listBindingListener" ) ) ; ReferenceListValidator rlv_ref_list = new ReferenceListValidator ( "org.apache.aries.blueprint.sample.InterfaceA" ) ; rlv_ref_list . addReferenceListenerValidator ( rlrv_2 ) ; rlv_ref_list . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , "ref-list" ) ) ; BeanValidator bv_listBindingListener = new BeanValidator ( "org.apache.aries.blueprint.sample.BindingListener" ) ; bv_listBindingListener . validate ( metadataProxy . getComponentMetadata ( sampleBlueprintContainerServiceId , "listBindingListener" ) ) ; ReferenceListenerValidator rlrv_3 = new ReferenceListenerValidator ( "bind" , "unbind" ) ; rlrv_3 . setListenerComponentValidator ( new RefValidator ( "circularReference" ) ) ; ReferenceListValidator rlv_2 = new ReferenceListValidator ( "org.apache.aries.blueprint.sample.InterfaceA" , 2 ) ;

Fix:
assertEquals ( "There<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>two<seq2seq4repair_space>service<seq2seq4repair_space>components<seq2seq4repair_space>in<seq2seq4repair_space>this<seq2seq4repair_space>sample" , 2 , serviceComponentIds . length ) ;