public void testMultipleContentCapabilities() throws Exception {
Provisioner provisioner = ServiceLocator.getRequiredService(Provisioner.class);
ResourceBuilder builderF = new DefaultResourceBuilder();
ResourceIdentity identityF = ResourceIdentity.create(RESOURCE_F, Version.emptyVersion);
builderF.addIdentityCapability(identityF);
builderF.addContentCapability(deployer.getDeployment(CONTENT_F1), null, Collections.singletonMap(CAPABILITY_INCLUDE_RUNTIME_TYPE_DIRECTIVE, RuntimeType.TOMCAT.name()));
builderF.addContentCapability(deployer.getDeployment(CONTENT_F2), null, Collections.singletonMap(CAPABILITY_INCLUDE_RUNTIME_TYPE_DIRECTIVE, RuntimeType.WILDFLY.name()));
builderF.addContentCapability(deployer.getDeployment(CONTENT_F3), null, Collections.singletonMap(CAPABILITY_INCLUDE_RUNTIME_TYPE_DIRECTIVE, RuntimeType.KARAF.name()));
ResourceBuilder builderG = new DefaultResourceBuilder();
ResourceIdentity identityG = ResourceIdentity.create(RESOURCE_G, Version.emptyVersion);
builderG.addIdentityCapability(identityG);
builderG.addContentCapability(deployer.getDeployment(CONTENT_G1), null, Collections.singletonMap(CAPABILITY_INCLUDE_RUNTIME_TYPE_DIRECTIVE, RuntimeType.TOMCAT.name()));
builderG.addContentCapability(deployer.getDeployment(CONTENT_G2), null, Collections.singletonMap(CAPABILITY_INCLUDE_RUNTIME_TYPE_DIRECTIVE, RuntimeType.WILDFLY.name()));
builderG.addContentCapability(deployer.getDeployment(CONTENT_G3), null, Collections.singletonMap(CAPABILITY_INCLUDE_RUNTIME_TYPE_DIRECTIVE, RuntimeType.KARAF.name()));
List<ResourceHandle> handles = new ArrayList<>();
handles.add(provisioner.installSharedResource(builderF.getResource()));
handles.add(provisioner.installResource(builderG.getResource()));
try {
// Verify that the modules got installed
Runtime runtime = RuntimeLocator.getRequiredRuntime();
for (ResourceHandle handle : handles) {
ResourceIdentity identity = handle.getResource().getIdentity();
Assert.assertSame(handle.getModule(), runtime.getModule(identity));
Assert.assertEquals("ACTIVE " + identity, State.ACTIVE, handle.getModule().getState());
}
// Verify that the module activator was called
Module module = runtime.getModule(identityG);