Package javax.resource.spi

Examples of javax.resource.spi.ConnectionRequestInfo


        assertEquals(con1, mcon);
    }

    @Test
    public void testMatchConnectionDifferentConnectioRequestInfoNotBound() throws Exception {
        ConnectionRequestInfo cri1 = new DummyConnectionRequestInfo();
        ConnectionRequestInfo cri2 = new DummyConnectionRequestInfo();

        Subject subject = null;
        assertTrue("request info object are differnt", cri1 != cri2);

        Set<AbstractManagedConnectionImpl> connectionSet = new HashSet<AbstractManagedConnectionImpl>();
View Full Code Here


        assertEquals("incorrect connection returned", con1, mcon);
    }

    @Test
    public void testMatchConnectionDifferentConnectioRequestInfoBound() throws Exception {
        ConnectionRequestInfo cri1 = new DummyConnectionRequestInfo();
        ConnectionRequestInfo cri2 = new DummyConnectionRequestInfo();

        Subject subject = null;

        assertTrue("request info object are differnt", cri1 != cri2);
View Full Code Here

    @Test
    public void testMatchConnectionInvalidatedWithSameConnectioRequestInfo() throws Exception {
        Subject subject = null;
        Set<AbstractManagedConnectionImpl> connectionSet = new HashSet<AbstractManagedConnectionImpl>();
        ConnectionRequestInfo cri = new DummyConnectionRequestInfo();

        DummyManagedConnectionImpl con1 = new DummyManagedConnectionImpl(mcf, cri, subject);
        con1.setBound(true);
        con1.setCon(connectionSet);
        connectionSet.add(con1);
View Full Code Here

    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;
View Full Code Here

        assertEquals("got back what we set", s, mc.getSubject());
    }

    @Test
    public void testGetSetConnectionRequestInfo() {
        ConnectionRequestInfo ri = new ConnectionRequestInfo() {
        };

        mc.setConnectionRequestInfo(ri);
        assertEquals("got back what we set", ri, mc.getConnectionRequestInfo());
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Connection getConnection(String user, String password) throws SQLException {
        ConnectionRequestInfo cri = new WrappedConnectionRequestInfo(user, password);
        try {
            WrappedConnection wc = (WrappedConnection) cm.allocateConnection(mcf, cri);
            wc.setDataSource(this);
            wc.setSpy(mcf.getSpy().booleanValue());
            wc.setJndiName(mcf.getJndiName());
View Full Code Here

        if ((null != connectionSet) && !connectionSet.isEmpty()) {
            for (Object con : (Set<?>) connectionSet) {
                if (con instanceof ManagedConnectionImpl) {
                    ManagedConnectionImpl conn = (ManagedConnectionImpl) con;
                    ConnectionRequestInfo otherCxRequestInfo = conn.getCxRequestInfo();
                    if (null == otherCxRequestInfo || otherCxRequestInfo.equals(cxRequestInfo)) {
                        return conn;
                    }

                } else {
                    log(Level.WARNING, "Unexpected element in list: " + con);
View Full Code Here

/*     */   }
/*     */
/*     */   public Connection getConnection(String user, String password)
/*     */     throws SQLException
/*     */   {
/* 100 */     ConnectionRequestInfo cri = new WrappedConnectionRequestInfo(user, password);
/*     */     try
/*     */     {
/* 103 */       WrappedConnection wc = (WrappedConnection)this.cm.allocateConnection(this.mcf, cri);
/* 104 */       wc.setDataSource(this);
/* 105 */       return wc;
View Full Code Here

    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;
View Full Code Here

    public Reference getReference() {
        return reference;
    }

    private ConnectionRequestInfo getConnectionRequestInfo() {
        return new ConnectionRequestInfo() {

            @Override
            public boolean equals(Object obj) {
                return true;
            }
View Full Code Here

TOP

Related Classes of javax.resource.spi.ConnectionRequestInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.