public void testExtensionProviders() throws Throwable
{
KernelController controller = getController();
MainDeployerImpl main = new MainDeployerImpl();
main.setStructuralDeployers(createStructuralDeployers());
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("JARStructure", ExposedJARStructure.class.getName());
controller.install(builder.getBeanMetaData());
builder = BeanMetaDataBuilder.createBuilder("FileStructure", ExposedFileStructure.class.getName());
controller.install(builder.getBeanMetaData());
ControllerContext jarContext = controller.getInstalledContext("JARStructure");
assertNotNull(jarContext);
ExposedJARStructure jarStructure = (ExposedJARStructure)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("RhtDeployer", TestExtensionDeployer.class.getName());
builder.addConstructorParameter(String.class.getName(), ".rht");
controller.install(builder.getBeanMetaData());
assertEquals(1, matchers.size());
builder = BeanMetaDataBuilder.createBuilder("JbsDeployer", TestExtensionDeployer.class.getName());
builder.addConstructorParameter(String.class.getName(), ".jbs");
controller.install(builder.getBeanMetaData());
assertEquals(2, matchers.size());
Set<String> suffixes = jarStructure.getSuffixes();
assertTrue(suffixes.contains(".rhts"));
assertTrue(suffixes.contains(".jbss"));
Deployers deployers = createDeployers();
main.setDeployers(deployers);
FeedbackDeployer rhtDeployer = addDeployer(main, "RhtDeployer");
FeedbackDeployer jbsDeployer = addDeployer(main, "JbsDeployer");
Deployment deploymentRHT = createDeployment("/matchers", "some.rhts");