// test getComponentMetadata
// bean: foo
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"));
// bean: bar
BeanPropertyValidator bpv_value = new BeanPropertyValidator("value");
bpv_value.setObjectValueValidator(new ValueValidator("Hello 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 list 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"));
// service: ref=foo, no componentId set. So using it to test getComponentIdsByType.
String[] serviceComponentIds = metadataProxy.getComponentIdsByType(sampleBlueprintContainerServiceId, BlueprintMetadataMBean.SERVICE_METADATA);
assertEquals("There should be only one service component in this sample", 1, serviceComponentIds.length);
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);