public void testMatchers() throws Throwable
{
KernelController controller = getController();
MainDeployerImpl main = new MainDeployerImpl();
main.setStructuralDeployers(createStructuralDeployers());
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("JARStructure", JARStructure.class.getName());
controller.install(builder.getBeanMetaData());
builder = BeanMetaDataBuilder.createBuilder("FileStructure", ExposedFileStructure.class.getName());
controller.install(builder.getBeanMetaData());
ControllerContext jarContext = controller.getInstalledContext("JARStructure");
assertNotNull(jarContext);
JARStructure jarStructure = (JARStructure)jarContext.getTarget();
assertNotNull(jarStructure);
addStructureDeployer(main, jarStructure);
ControllerContext fileContext = controller.getInstalledContext("FileStructure");
assertNotNull(fileContext);
ExposedFileStructure fileStructure = (ExposedFileStructure)fileContext.getTarget();
assertNotNull(fileStructure);
addStructureDeployer(main, fileStructure);
Set<FileMatcher> matchers = fileStructure.getMatchers();
assertNotNull(matchers);
assertEmpty(matchers);
builder = BeanMetaDataBuilder.createBuilder("BeanDeployer", TestBeanDeployer.class.getName());
controller.install(builder.getBeanMetaData());
assertEquals(1, matchers.size());
builder = BeanMetaDataBuilder.createBuilder("BshDeployer", TestBshDeployer.class.getName());
controller.install(builder.getBeanMetaData());
assertEquals(2, matchers.size());
builder = BeanMetaDataBuilder.createBuilder("ExactNameDeployer", TestNameDeployer.class.getName());
builder.addConstructorParameter(String.class.getName(), "some.bsh");
controller.install(builder.getBeanMetaData());
assertEquals(3, matchers.size());
Deployers deployers = createDeployers();
main.setDeployers(deployers);
FeedbackDeployer beanDeployer = addDeployer(main, "BeanDeployer");
FeedbackDeployer shellDeployer = addDeployer(main, "BshDeployer");
FeedbackDeployer nameDeployer = addDeployer(main, "ExactNameDeployer");