Search in sources :

Example 1 with AuthorisationServiceSupplier

use of io.aeron.security.AuthorisationServiceSupplier in project aeron by real-logic.

the class ConsensusModuleContextTest method shouldInstantiateAuthorisationServiceSupplierBasedOnTheSystemProperty.

@Test
void shouldInstantiateAuthorisationServiceSupplierBasedOnTheSystemProperty() {
    System.setProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME, TestAuthorisationSupplier.class.getName());
    try {
        context.conclude();
        final AuthorisationServiceSupplier supplier = context.authorisationServiceSupplier();
        assertNotSame(DEFAULT_AUTHORISATION_SERVICE_SUPPLIER, supplier);
        assertInstanceOf(TestAuthorisationSupplier.class, supplier);
    } finally {
        System.clearProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME);
    }
}
Also used : AuthorisationServiceSupplier(io.aeron.security.AuthorisationServiceSupplier) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with AuthorisationServiceSupplier

use of io.aeron.security.AuthorisationServiceSupplier in project aeron by real-logic.

the class ConsensusModuleContextTest method shouldUseProvidedAuthorisationServiceSupplierInstance.

@Test
void shouldUseProvidedAuthorisationServiceSupplierInstance() {
    final AuthorisationServiceSupplier providedSupplier = mock(AuthorisationServiceSupplier.class);
    context.authorisationServiceSupplier(providedSupplier);
    assertSame(providedSupplier, context.authorisationServiceSupplier());
    System.setProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME, TestAuthorisationSupplier.class.getName());
    try {
        context.conclude();
        assertSame(providedSupplier, context.authorisationServiceSupplier());
    } finally {
        System.clearProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME);
    }
}
Also used : AuthorisationServiceSupplier(io.aeron.security.AuthorisationServiceSupplier) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with AuthorisationServiceSupplier

use of io.aeron.security.AuthorisationServiceSupplier in project aeron by real-logic.

the class ArchiveContextTests method shouldInstantiateAuthorisationServiceSupplierBasedOnTheSystemProperty.

@Test
void shouldInstantiateAuthorisationServiceSupplierBasedOnTheSystemProperty() {
    System.setProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME, TestAuthorisationSupplier.class.getName());
    try {
        context.conclude();
        final AuthorisationServiceSupplier supplier = context.authorisationServiceSupplier();
        assertNotSame(DEFAULT_AUTHORISATION_SERVICE_SUPPLIER, supplier);
        assertInstanceOf(TestAuthorisationSupplier.class, supplier);
    } finally {
        System.clearProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME);
    }
}
Also used : AuthorisationServiceSupplier(io.aeron.security.AuthorisationServiceSupplier) Test(org.junit.jupiter.api.Test)

Example 4 with AuthorisationServiceSupplier

use of io.aeron.security.AuthorisationServiceSupplier in project Aeron by real-logic.

the class ConsensusModuleContextTest method shouldInstantiateAuthorisationServiceSupplierBasedOnTheSystemProperty.

@Test
void shouldInstantiateAuthorisationServiceSupplierBasedOnTheSystemProperty() {
    System.setProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME, TestAuthorisationSupplier.class.getName());
    try {
        context.conclude();
        final AuthorisationServiceSupplier supplier = context.authorisationServiceSupplier();
        assertNotSame(DEFAULT_AUTHORISATION_SERVICE_SUPPLIER, supplier);
        assertInstanceOf(TestAuthorisationSupplier.class, supplier);
    } finally {
        System.clearProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME);
    }
}
Also used : AuthorisationServiceSupplier(io.aeron.security.AuthorisationServiceSupplier) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with AuthorisationServiceSupplier

use of io.aeron.security.AuthorisationServiceSupplier in project Aeron by real-logic.

the class ConsensusModuleContextTest method shouldUseProvidedAuthorisationServiceSupplierInstance.

@Test
void shouldUseProvidedAuthorisationServiceSupplierInstance() {
    final AuthorisationServiceSupplier providedSupplier = mock(AuthorisationServiceSupplier.class);
    context.authorisationServiceSupplier(providedSupplier);
    assertSame(providedSupplier, context.authorisationServiceSupplier());
    System.setProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME, TestAuthorisationSupplier.class.getName());
    try {
        context.conclude();
        assertSame(providedSupplier, context.authorisationServiceSupplier());
    } finally {
        System.clearProperty(AUTHORISATION_SERVICE_SUPPLIER_PROP_NAME);
    }
}
Also used : AuthorisationServiceSupplier(io.aeron.security.AuthorisationServiceSupplier) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

AuthorisationServiceSupplier (io.aeron.security.AuthorisationServiceSupplier)10 Test (org.junit.jupiter.api.Test)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 Aeron (io.aeron.Aeron)2 ChannelUriStringBuilder (io.aeron.ChannelUriStringBuilder)2 CommonContext (io.aeron.CommonContext)2 Publication (io.aeron.Publication)2 Context (io.aeron.archive.Archive.Context)2 DEDICATED (io.aeron.archive.ArchiveThreadingMode.DEDICATED)2 SHARED (io.aeron.archive.ArchiveThreadingMode.SHARED)2 MIN_CAPACITY (io.aeron.archive.Catalog.MIN_CAPACITY)2 Checksum (io.aeron.archive.checksum.Checksum)2 AeronArchive (io.aeron.archive.client.AeronArchive)2 AeronArchive.segmentFileBasePosition (io.aeron.archive.client.AeronArchive.segmentFileBasePosition)2 ArchiveException (io.aeron.archive.client.ArchiveException)2 RecordingSubscriptionDescriptorConsumer (io.aeron.archive.client.RecordingSubscriptionDescriptorConsumer)2 LOCAL (io.aeron.archive.codecs.SourceLocation.LOCAL)2 TruncateRecordingRequestDecoder (io.aeron.archive.codecs.TruncateRecordingRequestDecoder)2 RecordingPos (io.aeron.archive.status.RecordingPos)2 MediaDriver (io.aeron.driver.MediaDriver)2