Java Code Examples for org.jboss.as.subsystem.test.KernelServices#isSuccessfulBoot()

The following examples show how to use org.jboss.as.subsystem.test.KernelServices#isSuccessfulBoot() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RealmsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testFilesystemRealm() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("realms-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }

    ServiceName serviceName = Capabilities.SECURITY_REALM_RUNTIME_CAPABILITY.getCapabilityServiceName("FilesystemRealm");
    ModifiableSecurityRealm securityRealm = (ModifiableSecurityRealm) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(securityRealm);

    RealmIdentity identity1 = securityRealm.getRealmIdentity(fromName("firstUser"));
    Assert.assertTrue(identity1.exists());
    identity1.dispose();

    testModifiability(securityRealm);
}
 
Example 2
Source File: IOSubsystem11TestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testRuntime() throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
            .setSubsystemXml(getSubsystemXml());
    KernelServices mainServices = builder.build();
    if (!mainServices.isSuccessfulBoot()) {
        Assert.fail(mainServices.getBootError().toString());
    }
    ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
    workerServiceController.setMode(ServiceController.Mode.ACTIVE);
    workerServiceController.awaitValue();
    XnioWorker worker = workerServiceController.getService().getValue();
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
    PathAddress addr = PathAddress.parseCLIStyleAddress("/subsystem=io/worker=default");
    ModelNode op = Util.createOperation("read-resource", addr);
    op.get("include-runtime").set(true);
    mainServices.executeOperation(op);
}
 
Example 3
Source File: IOSubsystem20TestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testRuntime() throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
            .setSubsystemXml(getSubsystemXml());
    KernelServices mainServices = builder.build();
    if (!mainServices.isSuccessfulBoot()) {
        Assert.fail(String.valueOf(mainServices.getBootError()));
    }
    ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
    workerServiceController.setMode(ServiceController.Mode.ACTIVE);
    workerServiceController.awaitValue();
    XnioWorker worker = workerServiceController.getService().getValue();
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
    PathAddress addr = PathAddress.parseCLIStyleAddress("/subsystem=io/worker=default");
    ModelNode op = Util.createOperation("read-resource", addr);
    op.get("include-runtime").set(true);
    mainServices.executeOperation(op);
}
 
Example 4
Source File: RealmsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testAggregateRealmWithPrincipalTransformer() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("realms-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }

    ServiceName serviceName = Capabilities.SECURITY_REALM_RUNTIME_CAPABILITY.getCapabilityServiceName("AggregateRealmTwo");
    SecurityRealm securityRealm = (SecurityRealm) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(securityRealm);

    RealmIdentity identity1 = securityRealm.getRealmIdentity(fromName("firstUser"));
    Assert.assertTrue(identity1.exists());
    //Assert that transformation was successful and the correct identity and attributes were loaded from filesystem-realm-2
    Assert.assertEquals(3, identity1.getAuthorizationIdentity().getAttributes().size());
    Assert.assertEquals("[Jane2]", identity1.getAuthorizationIdentity().getAttributes().get("firstName").toString());
    Assert.assertEquals("[Doe2]", identity1.getAuthorizationIdentity().getAttributes().get("lastName").toString());
    Assert.assertEquals("[Employee2, Manager2, Admin2]", identity1.getAuthorizationIdentity().getAttributes().get("roles").toString());

    identity1.dispose();
}
 
Example 5
Source File: RealmsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testAggregateRealm() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("realms-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }

    ServiceName serviceName = Capabilities.SECURITY_REALM_RUNTIME_CAPABILITY.getCapabilityServiceName("AggregateRealmOne");
    SecurityRealm securityRealm = (SecurityRealm) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(securityRealm);

    RealmIdentity identity1 = securityRealm.getRealmIdentity(fromName("firstUser"));
    Assert.assertTrue(identity1.exists());

    Assert.assertEquals(3, identity1.getAuthorizationIdentity().getAttributes().size());
    Assert.assertEquals("[Jane]", identity1.getAuthorizationIdentity().getAttributes().get("firstName").toString());
    Assert.assertEquals("[Doe]", identity1.getAuthorizationIdentity().getAttributes().get("lastName").toString());
    Assert.assertEquals("[Employee, Manager, Admin]", identity1.getAuthorizationIdentity().getAttributes().get("roles").toString());

    identity1.dispose();
}
 
Example 6
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testPrincipalTransformerTree() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }

    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "TestingDomain");
    ServiceName serviceName = Capabilities.PRINCIPAL_TRANSFORMER_RUNTIME_CAPABILITY.getCapabilityServiceName("tree");
    PrincipalTransformer transformer = (PrincipalTransformer) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(transformer);

    Assert.assertEquals("[email protected]", transformer.apply(new NamePrincipal("[email protected]")).getName()); // com to org
    Assert.assertEquals("beta", transformer.apply(new NamePrincipal("[email protected]")).getName()); // remove server part
    Assert.assertEquals("[email protected]", transformer.apply(new NamePrincipal("[email protected]")).getName()); // keep
    Assert.assertEquals(null, transformer.apply(new NamePrincipal("invalid"))); // not an e-mail address
    Assert.assertEquals(null, transformer.apply(null));
}
 
Example 7
Source File: RealmsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testPropertyRealm() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("realms-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }

    ServiceName serviceName = Capabilities.SECURITY_REALM_RUNTIME_CAPABILITY.getCapabilityServiceName("HashedPropertyRealm");
    SecurityRealm securityRealm = (SecurityRealm) services.getContainer().getService(serviceName).getValue();
    testAbstractPropertyRealm(securityRealm);

    ServiceName serviceName2 = Capabilities.SECURITY_REALM_RUNTIME_CAPABILITY.getCapabilityServiceName("ClearPropertyRealm");
    SecurityRealm securityRealm2 = (SecurityRealm) services.getContainer().getService(serviceName2).getValue();
    testAbstractPropertyRealm(securityRealm2);

    RealmIdentity identity1 = securityRealm2.getRealmIdentity(fromName("user1"));
    Object[] groups = identity1.getAuthorizationIdentity().getAttributes().get("groupAttr").toArray();
    Assert.assertArrayEquals(new Object[]{"firstGroup","secondGroup"}, groups);
}
 
Example 8
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSourceAddressRoleDecoderWithIPv6() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }
    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "TestingDomainIPv6");

    ServiceName serviceName = Capabilities.ROLE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("ipv6RoleDecoder");
    RoleDecoder roleDecoder = (RoleDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(roleDecoder);

    String sourceAddress = "2001:db8:85a3:0:0:8a2e:370:7334";
    Roles decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity(sourceAddress));
    assertTrue(decodedRoles.contains("admin"));
    assertTrue(decodedRoles.contains("user"));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("0:0:0:0:ffff:0:192.0.2.128")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.16.18")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity(null)));
}
 
Example 9
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSourceAddressRoleDecoder() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }
    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "TestingDomain");

    ServiceName serviceName = Capabilities.ROLE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("ipRoleDecoder1");
    RoleDecoder roleDecoder = (RoleDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(roleDecoder);

    String sourceAddress = "10.12.14.16";
    Roles decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity(sourceAddress));
    assertTrue(decodedRoles.contains("admin"));
    assertTrue(decodedRoles.contains("user"));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.16.18")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity(null)));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("0:0:0:0:ffff:0:192.0.2.128")));
}
 
Example 10
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testCustomEvidenceDecoder() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }
    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "CustomTestingDomain");

    X509Certificate[] certificateChain = populateCertificateChain(true);
    X509PeerCertificateChainEvidence evidence = new X509PeerCertificateChainEvidence(certificateChain);

    ServiceName serviceName = Capabilities.EVIDENCE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("customEvidenceDecoder");
    EvidenceDecoder evidenceDecoder = (EvidenceDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(evidenceDecoder);
    // custom evidence decoder just converts the subject name to upper case
    Assert.assertEquals("CN=BOB0", evidenceDecoder.getPrincipal(evidence).getName());
}
 
Example 11
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testAggregateRoleDecoder() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }
    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "TestingDomainAggregate");

    ServiceName serviceName = Capabilities.ROLE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("aggregateRoleDecoder");
    RoleDecoder roleDecoder = (RoleDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(roleDecoder);

    Roles decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.14.16"));
    assertTrue(decodedRoles.contains("admin"));
    assertTrue(decodedRoles.contains("user"));
    assertFalse(decodedRoles.contains("employee"));
    assertTrue(decodedRoles.contains("internal"));

    decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.14.18"));
    assertFalse(decodedRoles.contains("admin"));
    assertFalse(decodedRoles.contains("user"));
    assertTrue(decodedRoles.contains("employee"));
    assertTrue(decodedRoles.contains("internal"));

    decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.14.20"));
    assertFalse(decodedRoles.contains("admin"));
    assertFalse(decodedRoles.contains("user"));
    assertFalse(decodedRoles.contains("employee"));
    assertTrue(decodedRoles.contains("internal"));

    decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("10.10.14.20"));
    assertFalse(decodedRoles.contains("admin"));
    assertFalse(decodedRoles.contains("user"));
    assertFalse(decodedRoles.contains("employee"));
    assertFalse(decodedRoles.contains("internal"));

    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("2001:db8:85a3:0:0:8a2e:370:")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("12.12.16.18")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity(null)));
}
 
Example 12
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testSourceAddressRoleDecoderWithRegexIPv6() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }
    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "TestingDomainRegexIPv6");

    ServiceName serviceName = Capabilities.ROLE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("ipv6RegexRoleDecoder");
    RoleDecoder roleDecoder = (RoleDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(roleDecoder);

    HashSet<String> expectedRoles = new HashSet<>();
    expectedRoles.add("admin");
    expectedRoles.add("user");

    Roles decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("2001:db8:85a3:0:0:8a2e:370:7334"));
    assertTrue(decodedRoles.containsAll(expectedRoles));
    decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("2001:db8:85a3:0:0:8a2e:370:7335"));
    assertTrue(decodedRoles.containsAll(expectedRoles));
    decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("2001:db8:85a3:0:0:8a2e:370:7000"));
    assertTrue(decodedRoles.containsAll(expectedRoles));

    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("2001:db8:85a3:0:0:8a2e:370:")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("2222:db8:85a3:0:0:8a2e:370:7335")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("2001:db8:85a3:0:0:8a2e:370:7335:0")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("12.12.16.18")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity(null)));
}
 
Example 13
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testSourceAddressRoleDecoderWithRegex() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }
    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "TestingDomainRegex");

    ServiceName serviceName = Capabilities.ROLE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("regexRoleDecoder");
    RoleDecoder roleDecoder = (RoleDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(roleDecoder);

    HashSet<String> expectedRoles = new HashSet<>();
    expectedRoles.add("admin");
    expectedRoles.add("user");

    Roles decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.14.16"));
    assertTrue(decodedRoles.containsAll(expectedRoles));
    decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.14.18"));
    assertTrue(decodedRoles.containsAll(expectedRoles));
    decodedRoles = roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.14.1"));
    assertTrue(decodedRoles.containsAll(expectedRoles));

    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("12.12.16.18")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("10.12.14.18.20")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity("0:0:0:0:ffff:0:192.0.2.128")));
    Assert.assertEquals(Roles.NONE, roleDecoder.decodeRoles(getAuthorizationIdentity(null)));
}
 
Example 14
Source File: RealmsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testOAuth2Realm() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("realms-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }

    ServiceName serviceName = Capabilities.SECURITY_REALM_RUNTIME_CAPABILITY.getCapabilityServiceName("OAuth2Realm");
    SecurityRealm securityRealm = (SecurityRealm) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(securityRealm);
}
 
Example 15
Source File: RequestControllerSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testRuntime() throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
            .setSubsystemXml(getSubsystemXml());
    KernelServices mainServices = builder.build();
    if (!mainServices.isSuccessfulBoot()) {
        Assert.fail(mainServices.getBootError().toString());
    }
    ServiceController<RequestController> workerServiceController = (ServiceController<RequestController>) mainServices.getContainer().getService(RequestController.SERVICE_NAME);
    workerServiceController.setMode(ServiceController.Mode.ACTIVE);
    workerServiceController.awaitValue();
    RequestController controller = workerServiceController.getService().getValue();
    Assert.assertEquals(100, controller.getMaxRequestCount());
}
 
Example 16
Source File: IOSubsystem10TestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testRuntime() throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
            .setSubsystemXml(getSubsystemXml());
    KernelServices mainServices = builder.build();
    if (!mainServices.isSuccessfulBoot()) {
        Assert.fail(mainServices.getBootError().toString());
    }
    ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
    workerServiceController.setMode(ServiceController.Mode.ACTIVE);
    workerServiceController.awaitValue();
    XnioWorker worker = workerServiceController.getService().getValue();
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
}
 
Example 17
Source File: IOSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected KernelServices startKernelServices(String subsystemXml) throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
            .setSubsystemXml(subsystemXml);

    KernelServices kernelServices = builder.build();
    if (!kernelServices.isSuccessfulBoot()) {
        Assert.fail(String.valueOf(kernelServices.getBootError()));
    }

    return kernelServices;
}
 
Example 18
Source File: MappersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testEvidenceDecoder() throws Exception {
    KernelServices services = super.createKernelServicesBuilder(new TestEnvironment()).setSubsystemXmlResource("mappers-test.xml").build();
    if (!services.isSuccessfulBoot()) {
        Assert.fail(services.getBootError().toString());
    }
    TestEnvironment.activateService(services, Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY, "TestingDomain");

    X509Certificate[] certificateChain = populateCertificateChain(true);
    X509PeerCertificateChainEvidence evidence = new X509PeerCertificateChainEvidence(certificateChain);

    ServiceName serviceName = Capabilities.EVIDENCE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("subjectDecoder");
    EvidenceDecoder evidenceDecoder = (EvidenceDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(evidenceDecoder);
    Assert.assertEquals("CN=bob0", evidenceDecoder.getPrincipal(evidence).getName());

    serviceName = Capabilities.EVIDENCE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("rfc822Decoder");
    evidenceDecoder = (EvidenceDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(evidenceDecoder);
    Assert.assertEquals("[email protected]", evidenceDecoder.getPrincipal(evidence).getName());

    serviceName = Capabilities.EVIDENCE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("aggregateEvidenceDecoder");
    evidenceDecoder = (EvidenceDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(evidenceDecoder);
    Assert.assertEquals("[email protected]", evidenceDecoder.getPrincipal(evidence).getName());

    certificateChain = populateCertificateChain(false);
    evidence = new X509PeerCertificateChainEvidence(certificateChain);

    serviceName = Capabilities.EVIDENCE_DECODER_RUNTIME_CAPABILITY.getCapabilityServiceName("aggregateEvidenceDecoder");
    evidenceDecoder = (EvidenceDecoder) services.getContainer().getService(serviceName).getValue();
    Assert.assertNotNull(evidenceDecoder);
    Assert.assertEquals("CN=bob0", evidenceDecoder.getPrincipal(evidence).getName());

}