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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations