use of org.apache.qpid.server.model.NamedAddressSpace in project qpid-broker-j by apache.
the class VirtualHostAliasTest method testDefaultAliases_VirtualHostNameAlias.
public void testDefaultAliases_VirtualHostNameAlias() {
NamedAddressSpace addressSpace = _port.getAddressSpace("red");
assertNotNull(addressSpace);
assertEquals(_vhosts.get("red"), addressSpace);
addressSpace = _port.getAddressSpace("blue");
assertNotNull(addressSpace);
assertEquals(_vhosts.get("blue"), addressSpace);
addressSpace = _port.getAddressSpace("orange!");
assertNull(addressSpace);
}
use of org.apache.qpid.server.model.NamedAddressSpace in project qpid-broker-j by apache.
the class OAuth2AuthenticationProviderImplTest method testFailAuthenticateViaInvalidAuthorizationCode.
public void testFailAuthenticateViaInvalidAuthorizationCode() throws Exception {
Map<String, OAuth2MockEndpoint> mockEndpoints = new HashMap<>();
final OAuth2MockEndpoint mockTokenEndpoint = createMockTokenEndpoint();
mockTokenEndpoint.putExpectedParameter("code", TEST_INVALID_AUTHORIZATION_CODE);
mockTokenEndpoint.setResponse(400, "{\"error\":\"invalid_grant\",\"error_description\":\"authorization grant is not valid\"}");
mockEndpoints.put(TEST_TOKEN_ENDPOINT_PATH, mockTokenEndpoint);
mockEndpoints.put(TEST_IDENTITY_RESOLVER_ENDPOINT_PATH, createMockIdentityResolverEndpoint());
_server.setEndpoints(mockEndpoints);
final NamedAddressSpace mockAddressSpace = mock(NamedAddressSpace.class);
when(mockAddressSpace.getName()).thenReturn("mock");
AuthenticationResult authenticationResult = _authProvider.authenticateViaAuthorizationCode(TEST_INVALID_AUTHORIZATION_CODE, TEST_REDIRECT_URI, mockAddressSpace);
assertFailure(authenticationResult, "invalid_grant");
}
Aggregations