Assert.assertFalse(_mbs.isRegistered(MBeans.getObjectName(cs)));
Assert.assertFalse(_mbs.isRegistered(MBeans.getObjectName(cs, cs.getReferences().get(0))));
}
private Application createApplication() {
Application app = mock(BaseApplication.class);
when(app.getName()).thenReturn(TEST_APP);
// Services
List<Service> services = new ArrayList<Service>();
Service service = mock(BaseService.class);
when (service.getName()).thenReturn(TEST_COMPOSITE_SERVICE);
services.add(service);
when(app.getServices()).thenReturn(services);
// References
List<Reference> references = new ArrayList<Reference>();
Reference ref = mock(Reference.class);
when(ref.getName()).thenReturn(TEST_COMPOSITE_REFERENCE);
references.add(ref);
when(app.getReferences()).thenReturn(references);
// Bindings
Binding bind = mock(Binding.class);
List<Binding> bindings = new ArrayList<Binding>();
bindings.add(bind);
when(bind.getName()).thenReturn("xyz");
when(service.getGateways()).thenReturn(bindings);
// Transformers
List<Transformer> transformers = new ArrayList<Transformer>();
Transformer t = mock(Transformer.class);
transformers.add(t);
when(app.getTransformers()).thenReturn(transformers);
// Validators
List<Validator> validators = new ArrayList<Validator>();
Validator v = mock(Validator.class);
when(v.getName()).thenReturn(new QName("foo"));
validators.add(v);
when(app.getValidators()).thenReturn(validators);
// Components
List<ComponentService> compSvcs = new ArrayList<ComponentService>();
List<ComponentReference> compRefs = new ArrayList<ComponentReference>();
ComponentService compSvc = mock(ComponentService.class);
ComponentReference compRef = mock(ComponentReference.class);
when(compSvc.getName()).thenReturn(TEST_COMPONENT_SERVICE);
when(compRef.getName()).thenReturn(TEST_COMPONENT_REFERENCE);
compSvcs.add(compSvc);
compRefs.add(compRef);
when(app.getComponentServices()).thenReturn(compSvcs);
when(compSvc.getReferences()).thenReturn(compRefs);
return app;
}