Examples of ConnectionFactory


Examples of javax.jms.ConnectionFactory

   public void testNoClientIDConfigured_1() throws Exception
   {
      // the ConnectionFactories that ship with Messaging do not have their clientID
      // administratively configured.

      ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
      Connection c = cf.createConnection();

      assertNull(c.getClientID());

      c.close();
   }
View Full Code Here

Examples of javax.jms.ConnectionFactory

   public void testNoClientIDConfigured_2() throws Exception
   {
      // the ConnectionFactories that ship with Messaging do not have their clientID
      // administratively configured.

      ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
      Connection c = cf.createConnection();

      // set the client id immediately after the connection is created

      c.setClientID("sofiavergara2");
      assertEquals("sofiavergara2", c.getClientID());
View Full Code Here

Examples of javax.resource.cci.ConnectionFactory

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

    public void XtestSerialization() 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

Examples of javax.xml.registry.ConnectionFactory

    public void testJaxrJNDIConnection() throws Exception
    {
        String bindname = System.getProperty("jndi.bind.name");
        InitialContext ctx = getClientContext();
        ConnectionFactory factory = (ConnectionFactory) ctx.lookup(bindname);
        assertNotNull("Connection Factory from JNDI:", factory);
    }
View Full Code Here

Examples of mondrian.xmla.XmlaHandler.ConnectionFactory

  }

  @Override
  protected ConnectionFactory createConnectionFactory( final ServletConfig servletConfig ) throws ServletException {

    final ConnectionFactory delegate =
        super.createConnectionFactory( servletConfig );

    /*
     * This wrapper for the connection factory allows us to
     * override the list of roles with the ones defined in
     * the IPentahoSession and filter it through the
     * IConnectionUserRoleMapper.
     */
    return new ConnectionFactory() {

      public Map<String, Object> getPreConfiguredDiscoverDatasourcesResponse() {
        return delegate.getPreConfiguredDiscoverDatasourcesResponse();
      }


      public OlapConnection getConnection(
          String databaseName,
          String catalogName,
          String roleName,
          Properties props )
        throws SQLException {
        // What we do here is to filter the role names with the mapper.
        // First, get a user role mapper, if one is configured.
        final IPentahoSession session =
            PentahoSessionHolder.getSession();

        final IConnectionUserRoleMapper mondrianUserRoleMapper =
            PentahoSystem.get(
                IConnectionUserRoleMapper.class,
                MDXConnection.MDX_CONNECTION_MAPPER_KEY,
                null ); // Don't use the user session here yet.

        String[] effectiveRoles = new String[0];

        /*
         * If Catalog/Schema are null (this happens with high level metadata requests,
         * like DISCOVER_DATASOURCES) we can't use the role mapper, even if it
         * is present and configured.
         */
        if ( mondrianUserRoleMapper != null
            && catalogName != null ) {
          // Use the role mapper.
          try {
            effectiveRoles =
                mondrianUserRoleMapper
                    .mapConnectionRoles(
                        session,
                        catalogName );
            if ( effectiveRoles == null ) {
              effectiveRoles = new String[0];
            }
          } catch ( PentahoAccessControlException e ) {
            throw new SQLException( e );
          }
        }

        // Now we tokenize that list.
        boolean addComma = false;
        roleName = ""; //$NON-NLS-1$
        for ( String role : effectiveRoles ) {
          if ( addComma ) {
            roleName = roleName.concat( "," ); //$NON-NLS-1$
          }
          roleName = roleName.concat( role );
          addComma = true;
        }


        // Now let the delegate connection factory do its magic.
        if ( catalogName == null ) {

          return
              delegate.getConnection(
                  databaseName,
                  catalogName,
                  roleName.equals( "" )
                      ? null
                      : roleName,
View Full Code Here

Examples of net.rim.device.api.io.transport.ConnectionFactory

    }
   
    _success = success;
    _error = error;
   
    _factory = new ConnectionFactory();
   
    if (DeviceInfo.isSimulator()) {
      _factory.setPreferredTransportTypes(new int[] { TransportInfo.TRANSPORT_TCP_WIFI, TransportInfo.TRANSPORT_TCP_CELLULAR });
    }
   
View Full Code Here

Examples of net.spy.memcached.ConnectionFactory

  public boolean establish() throws KeyValueStoreClientException {
    if (_client != null) {
      shutdown();
    }
    try {
      ConnectionFactory cf = getConnectionFactory();
      if (cf == null) {
        this._client = new MemcachedClient(AddrUtil.getAddresses(_serverString));
      } else {
        this._client = new MemcachedClient(cf, AddrUtil.getAddresses(_serverString));
      }
View Full Code Here

Examples of org.apache.ace.connectionfactory.ConnectionFactory

        return tmpFile.toURI().toURL().toExternalForm();
    }

    private VelocityArtifactPreprocessor createProcessor() {
        return new VelocityArtifactPreprocessor(new ConnectionFactory() {
            public URLConnection createConnection(URL url, User user) throws IOException {
                return createConnection(url);
            }

            public URLConnection createConnection(URL url) throws IOException {
View Full Code Here

Examples of org.apache.ambari.server.controller.jdbc.ConnectionFactory

  private static final String COMPONENT_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("HostRoles", "component_name");

  @Test
  public void testPopulateResources() throws Exception {

    ConnectionFactory connectionFactory = createNiceMock(ConnectionFactory.class);
    Connection connection = createNiceMock(Connection.class);
    PreparedStatement statement = createNiceMock(PreparedStatement.class);
    ResultSet resultSet = createNiceMock(ResultSet.class);

    // set expectations
    expect(connectionFactory.getConnection()).andReturn(connection).once();
    expect(connection.prepareStatement((String) anyObject())).andReturn(statement).once();
    expect(statement.executeQuery()).andReturn(resultSet).once();
    expect(resultSet.next()).andReturn(true);
    expect(resultSet.getLong("RecordTimeStamp")).andReturn(999990L);
    expect(resultSet.getNString("MetricValue")).andReturn("0");
View Full Code Here

Examples of org.apache.commons.dbcp.ConnectionFactory

                                  String user,
                                  String password) {
    GenericObjectPool connectionPool = new GenericObjectPool();
    connectionPool.setMaxActive(256);
    connectionPool.setMaxIdle(256);
    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
        uri, user, password);
    //
    // This constructor modifies the connection pool, setting its connection
    // factory to this.  (So despite how it may appear, all of the objects
    // declared in this method are incorporated into the returned result.)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.