Package javax.resource.cci

Examples of javax.resource.cci.ConnectionFactory


        assertTrue(proxy instanceof ConnectionFactoryExtension);
        assertEquals("SomethingElse", ((ConnectionFactoryExtension)proxy).doSomethingElse());
    }

    public void testSerialization() throws Exception {
        ConnectionFactory proxy = (ConnectionFactory) kernel.invoke(managedConnectionFactoryName, "$getResource");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(proxy);
        oos.flush();
        byte[] bytes = baos.toByteArray();
        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
        Object proxy2 = ois.readObject();
        assertNotNull(proxy2);
        assertTrue(proxy instanceof ConnectionFactory);
        Connection connection = proxy.getConnection();
        assertNotNull(connection);
        kernel.stopGBean(managedConnectionFactoryName);
        ObjectInputStream ois2 = new ObjectInputStream(new ByteArrayInputStream(bytes));
        ConnectionFactory proxy3 = (ConnectionFactory) ois2.readObject();
        try {
            proxy3.getConnection();
            fail();
        } catch (IllegalStateException ise) {
        }
        kernel.startGBean(managedConnectionFactoryName);
        proxy3.getConnection();

    }
View Full Code Here


       
        _composer = getMessageComposer(MappedRecordBindingData.class);
        _selector = getOperationSelector(MappedRecordBindingData.class);

        try {
            ConnectionFactory factory = (ConnectionFactory) new InitialContext().lookup(_connectionFactoryJNDIName);
            _recordFactory = factory.getRecordFactory();
        } catch (Exception e) {
            throw new SwitchYardException(e);
        }
    }
View Full Code Here

        assertTrue(proxy instanceof ConnectionFactoryExtension);
        assertEquals("SomethingElse", ((ConnectionFactoryExtension)proxy).doSomethingElse());
    }

    public void testSerialization() throws Exception {
        ConnectionFactory proxy = (ConnectionFactory) kernel.invoke(managedConnectionFactoryName, "$getResource");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(proxy);
        oos.flush();
        byte[] bytes = baos.toByteArray();
        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
        Object proxy2 = ois.readObject();
        assertNotNull(proxy2);
        assertTrue(proxy instanceof ConnectionFactory);
        Connection connection = proxy.getConnection();
        assertNotNull(connection);
        kernel.stopGBean(managedConnectionFactoryName);
        ObjectInputStream ois2 = new ObjectInputStream(new ByteArrayInputStream(bytes));
        ConnectionFactory proxy3 = (ConnectionFactory) ois2.readObject();
        try {
            proxy3.getConnection();
            fail();
        } catch (IllegalStateException ise) {
        }
        kernel.startGBean(managedConnectionFactoryName);
        proxy3.getConnection();

    }
View Full Code Here

        env.put("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
        env.put("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
        env.put("java.naming.provider.url", "rmi://localhost:1099");

        Context ctx = new InitialContext(env);
        ConnectionFactory cf = (ConnectionFactory) ctx.lookup("geronimo:" + GLOBAL_NAME);
        assertNotNull(cf);
        kernel.stopGBean(managedConnectionFactoryName);
        try {
            ctx.lookup("geronimo:" + GLOBAL_NAME);
            fail();
        } catch (NamingException ne) {
        }
        kernel.startGBean(managedConnectionFactoryName);
        ConnectionFactory cf2 = (ConnectionFactory) ctx.lookup("geronimo:" + GLOBAL_NAME);
        assertNotNull(cf2);
    }
View Full Code Here

        kernel.startGBean(selfName);
        ((ConnectionFactory) proxy).getConnection();
    }

    public void testSerialization() throws Exception {
        ConnectionFactory proxy = (ConnectionFactory)kernel.invoke(selfName, "getProxy");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(proxy);
        oos.flush();
        byte[] bytes = baos.toByteArray();
        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
        Object proxy2 = ois.readObject();
        assertNotNull(proxy2);
        assertTrue(proxy instanceof ConnectionFactory);
        Connection connection = proxy.getConnection();
        assertNotNull(connection);
        kernel.stopGBean(selfName);
        ObjectInputStream ois2 = new ObjectInputStream(new ByteArrayInputStream(bytes));
        ConnectionFactory proxy3 = (ConnectionFactory)ois2.readObject();
        try {
            proxy3.getConnection();
            fail();
        } catch (IllegalStateException ise) {
        }
        kernel.startGBean(selfName);
        proxy3.getConnection();

    }
View Full Code Here

        env.put("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
        env.put("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
        env.put("java.naming.provider.url", "rmi://localhost:1099");

        Context ctx = new InitialContext(env);
        ConnectionFactory cf = (ConnectionFactory)ctx.lookup("geronimo:" + GLOBAL_NAME);
        assertNotNull(cf);
        kernel.stopGBean(selfName);
        try {
            ctx.lookup("geronimo:" + GLOBAL_NAME);
            fail();
        } catch (NamingException ne) {
        }
        kernel.startGBean(selfName);
        ConnectionFactory cf2 = (ConnectionFactory)ctx.lookup("geronimo:" + GLOBAL_NAME);
        assertNotNull(cf2);
    }
View Full Code Here

        kernel.startGBean(managedConnectionFactoryName);
        ((ConnectionFactory) proxy).getConnection();
    }

    public void testSerialization() throws Exception {
        ConnectionFactory proxy = (ConnectionFactory) kernel.invoke(managedConnectionFactoryName, "getProxy");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(proxy);
        oos.flush();
        byte[] bytes = baos.toByteArray();
        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
        Object proxy2 = ois.readObject();
        assertNotNull(proxy2);
        assertTrue(proxy instanceof ConnectionFactory);
        Connection connection = proxy.getConnection();
        assertNotNull(connection);
        kernel.stopGBean(managedConnectionFactoryName);
        ObjectInputStream ois2 = new ObjectInputStream(new ByteArrayInputStream(bytes));
        ConnectionFactory proxy3 = (ConnectionFactory) ois2.readObject();
        try {
            proxy3.getConnection();
            fail();
        } catch (IllegalStateException ise) {
        }
        kernel.startGBean(managedConnectionFactoryName);
        proxy3.getConnection();

    }
View Full Code Here

        env.put("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
        env.put("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
        env.put("java.naming.provider.url", "rmi://localhost:1099");

        Context ctx = new InitialContext(env);
        ConnectionFactory cf = (ConnectionFactory) ctx.lookup("geronimo:" + GLOBAL_NAME);
        assertNotNull(cf);
        kernel.stopGBean(managedConnectionFactoryName);
        try {
            ctx.lookup("geronimo:" + GLOBAL_NAME);
            fail();
        } catch (NamingException ne) {
        }
        kernel.startGBean(managedConnectionFactoryName);
        ConnectionFactory cf2 = (ConnectionFactory) ctx.lookup("geronimo:" + GLOBAL_NAME);
        assertNotNull(cf2);
    }
View Full Code Here

*/
public class CciTemplateTests {

  @Test
  public void testCreateIndexedRecord() throws ResourceException {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    RecordFactory recordFactory = mock(RecordFactory.class);
    IndexedRecord indexedRecord = mock(IndexedRecord.class);
    given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
    given(recordFactory.createIndexedRecord("name")).willReturn(indexedRecord);

    CciTemplate ct = new CciTemplate(connectionFactory);
    ct.createIndexedRecord("name");

View Full Code Here

    verify(recordFactory).createIndexedRecord("name");
  }

  @Test
  public void testCreateMappedRecord() throws ResourceException {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    RecordFactory recordFactory = mock(RecordFactory.class);
    MappedRecord mappedRecord = mock(MappedRecord.class);

    given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
    given(recordFactory.createMappedRecord("name")).willReturn(mappedRecord);

    CciTemplate ct = new CciTemplate(connectionFactory);
    ct.createMappedRecord("name");
View Full Code Here

TOP

Related Classes of javax.resource.cci.ConnectionFactory

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.