Java Code Examples for org.apache.phoenix.util.ReadOnlyProps#EMPTY_PROPS

The following examples show how to use org.apache.phoenix.util.ReadOnlyProps#EMPTY_PROPS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhoenixEmbeddedDriver.java    From phoenix with Apache License 2.0 6 votes vote down vote up
public ReadOnlyProps asProps() {
    Map<String, String> connectionProps = Maps.newHashMapWithExpectedSize(3);
    if (getZookeeperQuorum() != null) {
        connectionProps.put(QueryServices.ZOOKEEPER_QUARUM_ATTRIB, getZookeeperQuorum());
    }
    if (getPort() != null) {
        connectionProps.put(QueryServices.ZOOKEEPER_PORT_ATTRIB, getPort().toString());
    }
    if (getRootNode() != null) {
        connectionProps.put(QueryServices.ZOOKEEPER_ROOT_NODE_ATTRIB, getRootNode());
    }
    if (getPrincipal() != null && getKeytab() != null) {
        connectionProps.put(QueryServices.HBASE_CLIENT_PRINCIPAL, getPrincipal());
        connectionProps.put(QueryServices.HBASE_CLIENT_KEYTAB, getKeytab());
    }
    return connectionProps.isEmpty() ? ReadOnlyProps.EMPTY_PROPS : new ReadOnlyProps(
            connectionProps.entrySet().iterator());
}
 
Example 2
Source File: PhoenixEmbeddedDriver.java    From phoenix with Apache License 2.0 6 votes vote down vote up
public ReadOnlyProps asProps() {
    Map<String, String> connectionProps = Maps.newHashMapWithExpectedSize(3);
    if (getZookeeperQuorum() != null) {
        connectionProps.put(QueryServices.ZOOKEEPER_QUORUM_ATTRIB, getZookeeperQuorum());
    }
    if (getPort() != null) {
        connectionProps.put(QueryServices.ZOOKEEPER_PORT_ATTRIB, getPort().toString());
    }
    if (getRootNode() != null) {
        connectionProps.put(QueryServices.ZOOKEEPER_ROOT_NODE_ATTRIB, getRootNode());
    }
    if (getPrincipal() != null && getKeytab() != null) {
        connectionProps.put(QueryServices.HBASE_CLIENT_PRINCIPAL, getPrincipal());
        connectionProps.put(QueryServices.HBASE_CLIENT_KEYTAB, getKeytab());
    }
    return connectionProps.isEmpty() ? ReadOnlyProps.EMPTY_PROPS : new ReadOnlyProps(
            connectionProps.entrySet().iterator());
}
 
Example 3
Source File: SystemCatalogCreationOnConnectionIT.java    From phoenix with Apache License 2.0 6 votes vote down vote up
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerEnabledClientDisabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.TRUE.toString());
    Properties clientProps = getClientProperties(false, false);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    try {
        driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
        fail("Client should not be able to connect to cluster with inconsistent client-server namespace mapping properties");
    } catch (SQLException sqlE) {
        assertEquals(SQLExceptionCode.INCONSISTENT_NAMESPACE_MAPPING_PROPERTIES.getErrorCode(), sqlE.getErrorCode());
    }
    hbaseTables = getHBaseTables();
    assertEquals(0, hbaseTables.size());
    assertEquals(0, countUpgradeAttempts);
    return driver;
}
 
Example 4
Source File: SystemCatalogCreationOnConnectionIT.java    From phoenix with Apache License 2.0 6 votes vote down vote up
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerDisabledClientEnabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.FALSE.toString());
    Properties clientProps = getClientProperties(true, true);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    try {
        driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
        fail("Client should not be able to connect to cluster with inconsistent client-server namespace mapping properties");
    } catch (SQLException sqlE) {
        assertEquals(SQLExceptionCode.INCONSISTENT_NAMESPACE_MAPPING_PROPERTIES.getErrorCode(), sqlE.getErrorCode());
    }
    hbaseTables = getHBaseTables();
    assertEquals(0, hbaseTables.size());
    assertEquals(0, countUpgradeAttempts);
    assertFalse(isSystemNamespaceCreated());
    return driver;
}
 
Example 5
Source File: SystemCatalogCreationOnConnectionIT.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Test
public void testFirstConnectionDoNotUpgradePropSet() throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.FALSE.toString());
    Properties propsDoNotUpgradePropSet = new Properties();
    // Set doNotUpgradeProperty to true
    UpgradeUtil.doNotUpgradeOnFirstConnection(propsDoNotUpgradePropSet);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);

    driver.getConnectionQueryServices(getJdbcUrl(), propsDoNotUpgradePropSet);
    hbaseTables = getHBaseTables();
    assertFalse(hbaseTables.contains(PHOENIX_SYSTEM_CATALOG) || hbaseTables.contains(PHOENIX_NAMESPACE_MAPPED_SYSTEM_CATALOG));
    assertEquals(0, hbaseTables.size());
    assertEquals(1, countUpgradeAttempts);
}
 
Example 6
Source File: SystemCatalogCreationOnConnectionIT.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerEnabledClientEnabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.TRUE.toString());
    Properties clientProps = getClientProperties(true, true);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
    hbaseTables = getHBaseTables();
    assertEquals(PHOENIX_NAMESPACE_MAPPED_SYSTEM_TABLES, hbaseTables);
    assertEquals(0, countUpgradeAttempts);
    assertTrue(isSystemNamespaceCreated());
    return driver;
}
 
Example 7
Source File: SystemCatalogCreationOnConnectionIT.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerEnabledClientEnabledMappingDisabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.TRUE.toString());
    // client-side namespace mapping is enabled, but mapping SYSTEM tables to SYSTEM namespace is not
    Properties clientProps = getClientProperties(true, false);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
    hbaseTables = getHBaseTables();
    assertEquals(PHOENIX_SYSTEM_TABLES, hbaseTables);
    assertEquals(0, countUpgradeAttempts);
    assertFalse(isSystemNamespaceCreated());
    return driver;
}
 
Example 8
Source File: SystemCatalogCreationOnConnectionIT.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver firstConnectionNSMappingServerDisabledClientDisabled()
throws Exception {
    startMiniClusterWithToggleNamespaceMapping(Boolean.FALSE.toString());
    Properties clientProps = getClientProperties(false, false);
    SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver =
      new SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver(ReadOnlyProps.EMPTY_PROPS);
    driver.getConnectionQueryServices(getJdbcUrl(), clientProps);
    hbaseTables = getHBaseTables();
    assertEquals(PHOENIX_SYSTEM_TABLES, hbaseTables);
    assertEquals(0, countUpgradeAttempts);
    assertFalse(isSystemNamespaceCreated());
    return driver;
}
 
Example 9
Source File: QueryServicesTestImpl.java    From phoenix with Apache License 2.0 4 votes vote down vote up
public QueryServicesTestImpl(ReadOnlyProps defaultProps) {
    this(defaultProps, ReadOnlyProps.EMPTY_PROPS);
}
 
Example 10
Source File: PhoenixTestDriver.java    From phoenix with Apache License 2.0 4 votes vote down vote up
public PhoenixTestDriver() {
    this.overrideProps = ReadOnlyProps.EMPTY_PROPS;
    queryServices = new QueryServicesTestImpl(getDefaultProps());
}
 
Example 11
Source File: QueryServicesTestImpl.java    From phoenix with Apache License 2.0 4 votes vote down vote up
public QueryServicesTestImpl(ReadOnlyProps defaultProps) {
    this(defaultProps, ReadOnlyProps.EMPTY_PROPS);
}
 
Example 12
Source File: PhoenixTestDriver.java    From phoenix with Apache License 2.0 4 votes vote down vote up
public PhoenixTestDriver() {
    this(ReadOnlyProps.EMPTY_PROPS);
}