Search in sources :

Example 6 with ConnectionRequestInfo

use of javax.resource.spi.ConnectionRequestInfo in project cxf by apache.

the class AbstractManagedConnectionFactoryImpl method isMatch.

private boolean isMatch(final AbstractManagedConnectionImpl candidateConn, final ConnectionRequestInfo crInfo, final Subject subject) throws ResourceAdapterInternalException {
    boolean result = false;
    final ConnectionRequestInfo candidate = candidateConn.getConnectionRequestInfo();
    if (candidate.equals(crInfo) && (subject == null || subject.equals(candidateConn.getSubject()))) {
        try {
            validateReference(candidateConn, subject);
            result = true;
        } catch (Exception thrown) {
            result = false;
        }
    }
    return result;
}
Also used : ConnectionRequestInfo(javax.resource.spi.ConnectionRequestInfo) ResourceException(javax.resource.ResourceException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException)

Example 7 with ConnectionRequestInfo

use of javax.resource.spi.ConnectionRequestInfo in project cxf by apache.

the class DummyManagedConnectionFactoryImpl method testMatchConnectionSameConnectioRequestInfoNotBound.

@Test
public void testMatchConnectionSameConnectioRequestInfoNotBound() throws Exception {
    Subject subject = null;
    Set<AbstractManagedConnectionImpl> connectionSet = new HashSet<>();
    ConnectionRequestInfo cri = new DummyConnectionRequestInfo();
    DummyManagedConnectionImpl con1 = new DummyManagedConnectionImpl(mcf, cri, subject);
    connectionSet.add(con1);
    ManagedConnection mcon = mcf.matchManagedConnections(connectionSet, subject, cri);
    assertEquals(con1, mcon);
}
Also used : ManagedConnection(javax.resource.spi.ManagedConnection) Subject(javax.security.auth.Subject) ConnectionRequestInfo(javax.resource.spi.ConnectionRequestInfo) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

ConnectionRequestInfo (javax.resource.spi.ConnectionRequestInfo)7 Test (org.junit.Test)6 HashSet (java.util.HashSet)5 ManagedConnection (javax.resource.spi.ManagedConnection)5 Subject (javax.security.auth.Subject)5 ResourceException (javax.resource.ResourceException)1 ResourceAdapterInternalException (javax.resource.spi.ResourceAdapterInternalException)1